开发者

How to track change in textbox using jQuery

I want to check if user开发者_Go百科 changes the value of a textbox. If the user changes the value, then I want to display the changed value in a different textbox.


jquery has an event for this, .change(), this event will detect content changes when the textbox looses focus.

If you are wanting to detect the change at every keypress, .keyup() and .keydown() might be better suited for your needs.

Examples for your intended use:

//just change '.change' to '.keyup' or '.keydown' the rest is the same.
$('input').change(function() {
    $('target').val(this.value);
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜