Skip to content Skip to sidebar Skip to footer

Dropdownlist Onchange Show Other Dropdownlist

My problem is I want to create a category selecting system with javascript but when I choose an option it displays all divs; it should show only one div. For example : if value =

Solution 1:

Try this, Your problem is in if condition your are not using ==

functiongetData(dropdown) {
  var value = dropdown.options[dropdown.selectedIndex].value;
 if (value == 'emlak'){
  document.getElementById("emlak").style.display = "block";
  document.getElementById("vasita").style.display = "none";
 }
 if(value == 'vasita'){
   document.getElementById("vasita").style.display = "block";
   document.getElementById("emlak").style.display = "none";
 }
}

Demo

Update Demo

Post a Comment for "Dropdownlist Onchange Show Other Dropdownlist"