How to improve this jQuery statement?
<p>I have a page with inputs with IDs <code>language1</code>, <code>star1</code>, <code>language2</code>, <code>star2</code> etc. I need to activate the star input field if the corresponding language field has a <code>length &gt; 0</code>.</p>

<p>Right now I'm using the code below, but I believe I should be able to solve this with a while loop or similar to avoid repeating the same code over and over. Can someone help me with this?</p>

<pre><code>$('#language1').blur(function() {
    if ( $('#language1').val().length == 0){
        $('input[name=star1]',this.form).rating('readOnly',true);
    }
    else {
        $('input[name=star1]',this.form).rating('readOnly',false);
    }
});
$('#language2').blur(function() {
    if ( $('#language2').val().length == 0){
        $('input[name=star2]',this.form).rating('readOnly',true);
    }
    else {
        $('input[name=star2]',this.form).rating('readOnly',false);
    }
});
....
</code></pre>
