Hi,
I'm trying to replace " " with "_" in a username string, but even in the most basic form it doesn't seem to work?
I've also tried:
Any suggestions? Probably missing something silly :|
TIA
Andy
I'm trying to replace " " with "_" in a username string, but even in the most basic form it doesn't seem to work?
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 31</title>
<script type="text/javascript" src="[URL unfurl="true"]http://domain.com/new_js/jquery.js"></script>[/URL]
</head>
<body>
<script>
function do_replace() {
username_val = $('#comm_username').val();
username_val.replace(/\s+/i, "_");
alert("NEW: " + username_val);
}
</script>
<form onsubmit="return do_replace();">
<input name="comm_username" id="comm_username" />
<input type="submit" value="test" />
</form>
</body>
</html>
I've also tried:
Code:
username_val.replace(" ", "_");
Any suggestions? Probably missing something silly :|
TIA
Andy