Posted By

landonmiller on 01/21/10


Tagged

forms jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

netzwerktourist


Display hidden textfield if option is selected


 / Published in: jQuery
 

  1. //If div option "Selected Text" is selected, display test.
  2. $("#div").change(function() {
  3. if (($("option:selected", $(this)).attr("value")=="Selected Text")) {
  4. $("#div2:hidden").show();
  5. $('#div2').addClass('inputclass pageRequired');
  6. } else {
  7. $('#div2').removeClass('inputclass pageRequired');
  8. $('#div2').removeClass('warning');
  9. $("#div2:visible").hide();
  10. }
  11. });

Report this snippet  

You need to login to post a comment.