Back

Show/hide on basis of dropdown selected values

Copy Below Code View As A Text File Show Text Only Show API Edit Code
                            

<select id="mySelect"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <!-- Add more options as needed --> </select> <div class="area option1" style="display: none;">Content for Option 1</div> <div class="area option2" style="display: none;">Content for Option 2</div> //JS CODE $('#mySelect').change(function() { var selectedValue = $(this).val(); // Hide all areas by default $('.area').hide(); // Show the area corresponding to the selected option $('.area.' + selectedValue).show(); });