autofill input field with value of another input field
I'm going crazy about this. I found a plain JavaScript solution for my problem:
<script type="text/javascript" language="JavaScript" src="">
s1 = new String(catwebformform43575.EmailAddress.value)
function changeVal() {
document.catwebformform43575.Username.value = catwebformform43575.EmailAddress.value;
}
</script>
<BR>
<BR&g开发者_JAVA技巧t;
<form name="catwebformform43575">
<input type="text"id="EmailAddress" name="EmailAddress" value="" onkeyup = "changeVal()">
<input type="text" id="Username" name="Username" value="">
but I need a jQuery solution...Can anybody help?
$("#EmailAddress").keyup(function(){
$("#Username").val(this.value);
});
See a working demo
精彩评论