How i can i check the value of an input field continuously after it has been focused once ? (with jquery).I'm looking to make a live search and completely remove the submit button on my form.
I would bind the keyup and mouseup events to the input
$("#search").keyup(Search).mouseup(Search);
function Search(event)
{
// keyup for keyboard entry
// mouseup for copy-pasting with the mouse
}
After fighting with this in jsfiddle I finally came up with this:
$("#search").keyup(function(e) {
Search(e);
}).bind("paste", function(e) {
// have to do this so the DOM can catch up on mouse right-click paste
setTimeout(function() { Search(e); }, 100);
});
I wasn't aware of the paste
event, but clearly, it is awesome
Working example: http://jsfiddle.net/rLAxL/1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With