Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

HOW TO PERFORM AN ACTION AN OPTION IS CLICKED IN DROP DOWN

<select id="dropdown" onChange="showHide()">

    <option value="A">option1</option>
    <option value="B">option2</option>
    <option value="C">option3</option>
    <option value="D">option4</option>
</select>


 function showHide()
 {
   hideAll();
  var val = document.getElementById("dropdown").value;

  if(val == "A")
   document.getElementById("firstTextBoxId").style.display = 'block';
  else if(val == "B")
   document.getElementById("secondTextBoxId").style.display = 'block';
  else if(val == "C")
   document.getElementById("ThirdTextBoxId").style.display = 'block';
  else if(val == "D")
   document.getElementById("FourthTextBoxId").style.display = 'block';

}


function hideAll()
   {
      document.getElementById("firstTextBoxId").style.display = 'none';
      document.getElementById("secondTextBoxId").style.display = 'none';
      document.getElementById("thirdTextBoxId").style.display = 'none';
      document.getElementById("fourthTextBoxId").style.display = 'none';

    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #HOW #TO #PERFORM #AN #ACTION #AN #OPTION #IS #CLICKED #IN #DROP #DOWN
ADD COMMENT
Topic
Name
1+6 =