How to submit form onkeyup action

This code will submit your form on keyup

$('#element').bind('keyup', function() { 
    $('#form').delay(200).submit();
});

In this code you intercept the form submit and change it with an ajax submit

$("#form").submit(function (event) {
    event.preventDefault();
    $.ajax({
        type: "post",
        dataType: "html",
        url: '/url/toSubmit/to',
        data: $("#form").serialize(),,
        success: function (response) {
            //write here any code needed for handling success         }
    });
});

To use the delay function you should use jQuery 1.4. The parameter passed to delay is in milliseconds.


From this jQuery forum thread:

$('#element').bind('keyup', function() { $('#form').submit(); } );