Key event doesn't work correctly in Google Chrome
<p>On my web site I have the ability for users to use search by pressing <kbd>Enter</kbd>, having typed a string in the search input field. Here is some jQuery code to illustrate this:</p>

<pre><code>$(document).ready(function () {
    $('#search-input').on('keydown keyup keypress', function (event) {
        event = event || windows.event;
        if (event.keyCode == 13 || event.which == 13) {
            $("#search-button").click();
        }
    });

    $("#search-button").click(function () {
        var theUrl = "/search.aspx?search=" + document.getElementById('search-input').value;
        window.location = theUrl;
    });
}
</code></pre>

<p>On my master page I have the following code:</p>

<pre><code>&lt;input id="search-input" name="search" type="text" placeholder="Search..." /&gt;
&lt;button id="search-button" type="button"&gt;&lt;/button&gt;
</code></pre>

<p>Although this works in FireFox and IE9/IE8, it doesn't work in Chrome (except when in debug mode which is surprising). Please help me make it work correctly in all of these browsers.</p>
