Copy TextBox Value and Replace Spaces With Hyphens
Trying to copy the value of a first textbox as it is typed to a second textbox and replace any spaces with hyphens - Almost works except only the first space is replaced with a hyphen, can someone help please, I'm an absolute novice with Jquery!! thanks ....
Code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>TEST</title>
<SCRIPT language="javascript" src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></SCRIPT>
<SCRIPT type="text/javascript">//<![CDATA[
$(window).load(function(){
$("#title").on("keydown", function () {
$("#url").val($(this).val().toLowerCase().replace(" ", "-"));
});
});//]]>
</SCRIPT>
</head>
<body>
<input type="text" id="title" />
<input type="text" id="url" />
</body>
</html>