Input Validation on the go
<p>I want to validate a year in the form (XXXX) after the user enters 4 digits into the box, once the user has entered 4 digits I want to have that value so I can pass it to an ajax call.</p>

<pre><code>&lt;h6&gt;What year was the car manufactured&lt;/h6&gt;
&lt;input name="car_year" type="text"&gt;
&lt;div class="car_make_error car_year_error"&gt;Car Year Error&lt;/div&gt;
</code></pre>

<p>jquery:</p>

<pre><code>$("input[name='car_year']").change(function() {
    validate to make sure 4 digits are in the proper range and get the value of the
    4 digits
}
</code></pre>

<p>I know I could use key up but I was not exactly sure how any help would be appreciated.</p>

<p><strong>EDIT</strong></p>

<p>I've used this code:</p>

<pre><code>  $(car_year).keyup(function() {
    var year = $(this).attr('value');
    $('.car_year').html(year);
 });
</code></pre>
