开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜