Get an enter key press event

$("#txtSearch").keypress(function(e) {
    if (e.keyCode == "13") {
        alert("Enter key pressed");
    }
});

Advertisements

Trim all text inputs

// Trim all text inputs.
$(".form :text").each(function() {
    $(this).val($.trim($(this).val()));
});