Trigger function on Enter keypress
<p>I've a simple search function which i Want to trigger on Enter key press, though the function executes but the form also get posted.  </p>

<pre><code>&lt;script&gt;
function search()
{
 ...
}

$(document).ready(function() {
  $("#text").keypress(function (e) {
if (e.which==13)
  search();
 });
});

&lt;body&gt;
&lt;form id="searchForm" name="searchForm"&gt;
 &lt;input size="40" id="text" type="text" name="text" class="input" /&gt;
&lt;/form&gt;
&lt;/body&gt;
</code></pre>
