As a web developer, most of the times you would have to do some functionality / operation before form gets submitted.By default form gets submitted on click of enter key when the input field is focussed.Below code snipppet can be used to avoid default form submision.

$(document).ready(function() {
$(“form”).bind(“keypress”, function(e) {
if (e.keyCode == 13) {
searchFunc($(“#searchInput”).attr(‘value’)); //perform some operation
return false;
}
});
});

Related posts:

  1. How to parse XML data using Jquery
  2. How to switch a stylesheet using jQuery.
  3. How to create a for loop in jquery