jQuery returns undefined
<p>I have a really basic problem</p>

<pre><code>$('#myForm').submit(function() {
    var v= input_value(this,'validate_code');
    alert(v);
}

function input_value(form, name){
    var emptyFields = $(":input").filter(function() {
            if(this.name == name) {
            alert(this.value);
                return this.value;  
                }
    });
}
</code></pre>

<p>Why does <code>alert(this.value)</code> show the real value and <code>alert(v)</code> shows 'undefined' ?</p>
