Button should be disabled when wrong numbers are entered
<p>I am having some list of numbers in a div. The div gets number from a text field. Each number has unique ID. I am having a search field. Where search field is used to search number in the div. If i search wrong numbers it should show "NO Results found". And My ISSUE IS: I am having a Clear Search Button and a Search Button. The Clear Search should be enabled only when the correct numbers are searched, rest of the time clear search button should remain disabled.  I've been trying for this functionality for past 3 days. </p>

<p>Here is my code:</p>

<pre><code>$("#wmclrsrch").attr("disabled", "disabled");  //#wmclrsrch is a Clear Search Button
function fieldDisable() {
    $('#search_number').keyup(function() {         //#search_number is Search field
        if($(this).val() != '') {
            $("#wmclrsrch").removeAttr("disabled", "disabled");
            $("#wmclrsrch").attr("enabled", "enabled");
        } else {
            $("#wmclrsrch").attr("disabled", "disabled");
        }
    });
}
fieldDisable();
$('#wmsearch').after(function() {         //'#wmsearch is a Search Button
    if($(this).val() != '') {
        $("#wmclrsrch").removeAttr("disabled", "disabled");
        $("#wmclrsrch").attr("enabled", "enabled");
    } else {
        $("#wmclrsrch").attr("disabled", "disabled");
    }
});
</code></pre>

<p>NOTE: My Search Function is working good. Kindly tell me how to disable button when wrong numbers are entered.</p>
