Quick jQuery Question
<p>I have this code:</p>

<p><code>&lt;a href="javascript:$('#searchPost').submit()"&gt;Search&lt;/a&gt;</code></p>

<p>This submits my search form. I'm trying to keep it from submitting when empty. I know that'll be difficult to do inline, but when I tried to take the JS code out of the link, it ceases to work, even when the inline code calls a function outside of the link.</p>

<p>I was told to use this code:</p>

<pre><code>$('#searchPost').submit(function(event) {
    if ($(this).find('#searchBox').val() == '') {
       event.preventDefault();
    }
});
</code></pre>

<p>But I'm not sure where to put it to make it work. Of course, inline, that code doesn't do what I want it to. I put that completely in the head of my document and it didn't change much either. Any help?</p>
