how to check the content of a variable on submit
<p>I have a form that takes some post code, I'm trying to check the given post code by the user with the pre-defined post-code variable</p>

<pre><code> &lt;form id="post_code"&gt;
        &lt;input name="textfield" type="text" id="postcode" size="8" maxlength="8" /&gt;
        &lt;input type="image" id="submit_postcode" src="images/B_go.png" alt="Submit Postcode" width="59" height="24" border="0" /&gt;
 &lt;/form&gt;


var districtPostcodes = ['B1', 'B2', 'B3','B4'];
$("#submit_postcode").submit(function(){
    var userPostcode = $("#postcode").val().replace(/[^a-zA-Z0-9]/gi,'').toUpperCase();
    $.grep(districtPostcodes , function(val, i){
        if(userPostcode.indexOf(val) === 0){
            alert("Users postcode is part of district: "+val);
            return true;
        }else{
            return false;
    });
});
</code></pre>

<p>Thanks for your help.</p>
