title: jquery addclass to field if field equals certain value
body: <p>im trying to add a class on the fly to an input, if the selected value equals a certain value. </p>
  
  <pre><code>$("#schedule_event").chosen().change( function() {
          $('#1').slideUp();
          $('#2').slideUp();
          $('#3').slideUp();
          $('#' + $(this).val()).slideDown();
          if($(this).val == 1) {
              $("#schedule_opponent_id").addClass("required");
          }
  </code></pre>
  
  <p>or if there is a way of validating this through RoR validators would be great
  thanks</p>