Table of Contents
What is jquery
- Jquery is a small, light-weight and fast javascript library. It’s cross-platform and supports different types of browsers.
- It’s also referred as Write less do more? Because it takes a lot of common tasks that needs many lines of javascript code to accomplish, and binds them into methods which will be called with a single line of code whenever needed.
- It’s also very useful to simplify a lot of the complicated things from javascript, like AJAX calls and DOM manipulation.
How to show and hide div elements based on dropdown selection in jQuery
Answer: Use the jQuery change() method
The following example will demonstrate you ways to show and hide div elements based on the dropdown selection or selected option in a select box using the jQuery change() method together with the show() and hide() methods. The div boxes in this example are hidden by default using the CSS display property which value is set to none.
Example
Output