Add submit button to jquery search form
<p>I am trying to add a submit and a clear button to a quicksearch form in flexigrid. At the moment, when a user searches, they have press the enter key (13). So in conjunction with that, I would also like buttons that search and clear. I know I did this before, but cannot find the code after a restore. Many thanks</p>

<pre><code>//add search button
if (p.searchitems) {
    $('.pDiv2', g.pDiv).prepend("&lt;div class='pGroup'&gt; &lt;div class='pSearch pButton'&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt;  &lt;div class='btnseparator'&gt;&lt;/div&gt;");
    $('.pSearch', g.pDiv).click(function () {
        $(g.sDiv).slideToggle('fast', function () {
            $('.sDiv:visible input:first', g.gDiv).trigger('focus');
        });
    });
    //add search box
    g.sDiv.className = 'sDiv';
    var sitems = p.searchitems;
    var sopt = '', sel = '';
    for (var s = 0; s &lt; sitems.length; s++) {
        if (p.qtype == '' &amp;&amp; sitems[s].isdefault == true) {
            p.qtype = sitems[s].name;
            sel = 'selected="selected"';
        } else {
            sel = '';
        }
        sopt += "&lt;option value='" + sitems[s].name + "' " + sel + " &gt;" + sitems[s].display + "&amp;nbsp;&amp;nbsp;&lt;/option&gt;";
    }
    if (p.qtype == '') {
        p.qtype = sitems[0].name;
    }
    $(g.sDiv).append("&lt;div class='sDiv2'&gt;" + p.findtext + 
            " &lt;input type='text' value='" + p.query +"' size='30' name='q' class='qsbox' /&gt; "+
            " &lt;select name='qtype'&gt;" + sopt + "&lt;/select&gt;&lt;/div&gt;");
    //Split into separate selectors because of bug in jQuery 1.3.2
    $('input[name=q]', g.sDiv).keydown(function (e) {
        if (e.keyCode == 13) {
            g.doSearch();
        }
    });
    $('select[name=qtype]', g.sDiv).keydown(function (e) {
        if (e.keyCode == 13) {
            g.doSearch();
        }
    });
    $('input[value=Clear]', g.sDiv).click(function () {
        $('input[name=q]', g.sDiv).val('');
        p.query = '';
        g.doSearch();
    });
    $(g.bDiv).after(g.sDiv);
}
</code></pre>
