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);
});
精彩评论