Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

jQuery script to hide certain form fields

By: a guest on Feb 21st, 2012  |  syntax: jQuery  |  size: 0.36 KB  |  views: 7,635  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*! jQuery script to hide certain form fields */
  2.  
  3. $(document).ready(function() {
  4.  
  5.         //Hide the field initially
  6.         $("#hide1").hide();
  7.  
  8.         //Show the text field only when the third option is chosen - this doesn't
  9.         $('#awesome').change(function() {
  10.                 if ($("#awesome").val() == "Nope") {
  11.                         $("#hide1").show();
  12.                 }
  13.                 else {
  14.                         $("#hide1").hide();
  15.                 }
  16.         });
  17. });