disable button until it hasnt selected file yet
<p>im trying to do this but i dont know why is it not working. can you help this what's wrong with this code, its not working at all. i want to disable the submit button when the user has not select a file.</p>

<pre><code>&lt;html&gt;
&lt;meta charset="utf-8"&gt;
&lt;head&gt;



  &lt;form action="#" method="post"&gt;
    &lt;fieldset&gt;
        &lt;input type="file" /&gt;
    &lt;/fieldset&gt;
    &lt;fieldset&gt;
        &lt;input type="submit" /&gt;
    &lt;/fieldset&gt;


&lt;script type="text/javascript"&gt;
$(document).ready(
    function(){
        $('input:submit').attr('disabled',true);
        $('input:file').change(
            function(){
                if ($(this).val()){
                    $('input:submit').removeAttr('disabled'); 
                }
                else {
                    $('input:submit').attr('disabled',true);
                }
            });
    });
    &lt;/script&gt;
</code></pre>
