I have a form with an and I want to call a javascript function after 5 seconds of the last key press, and every time a new key is pres
Something like this should get you started:
var timeout; $('input[type=text]').keypress(function() { if(timeout) { clearTimeout(timeout); timeout = null; } timeout = setTimeout(myFunction, 5000) })