Display hidden textfield if option is selected


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.