jQuery keydown but ignore if in text box
<p>I'm calling a function (below) that will perform an action if the user presses the delete button. It is working fine but I need to to only do it on the page and not when a user is typing (inside an input or inside a textarea).</p>

<pre><code>$(window).keydown(function (evt) {
    if (evt.which == 46) { // delete
        goDoSomething();
    }
});
</code></pre>

<p>Any ideas <code>how I can amend the above</code> to <code>not fire</code> if the user is <code>in</code> an <code>input</code> or <code>textarea</code>?</p>

<p>Thanks in advance,</p>

<p>Dave</p>
