Change Enter Key using jQuery?
<p>I use mutliple framesets on a page, and each frameset has an associated button to perform a server/client side postback.  I wanted to change the default enter key to select the correct button and this was my soltuion using jQuery.</p>

<pre><code>    $("#&lt;%= SearchCustomers.ClientID %&gt;").find(":input").click(function() { $(this).parents("FIELDSET").addClass("default"); }).blur(function() { $(this).parents("FIELDSET").removeClass("default"); });
    $("#&lt;%= SearchGroups.ClientID %&gt;").find(":input").click(function() { $(this).parents("FIELDSET").addClass("default"); }).blur(function() { $(this).parents("FIELDSET").removeClass("default"); });


    $(document).keypress(function(e) {
        if ((e.which &amp;&amp; e.which == 13) || (e.keyCode &amp;&amp; e.keyCode == 13)) {
            $(".default").find(":submit,:button").click();
            return false;
        }
    });
</code></pre>

<p>This is working perfect, but I was looking for ways to improve this.  Right now, the code is dependent on me setting the framesets to "runat=server" so I can access the "ClientID" property and inject the ID into my javascript.  This makes the code a little less re-usable, so I was curious if somebody else had a better idea...</p>

<p>Thanks for your comments!</p>
