WordPress Tricks

Show Different Div or HTML elements while selecting different Dropdown option : JQuery and HTML

Basically this code is for advance users who have knowledge about HTML and JQuery.
Here i am sharing you the code which you can use for showing different Div (HTML elements) while selecting different dropdown option (HTML “select” tag). If you have any question feel free to ask question in the comments section.

*** JQuery Part

	<script>
	
	jQuery(document).ready(function() {
 
	jQuery('select.form-control').change(function(){
	  var target = jQuery(this).data('target');
 	  var show = $("option:selected", this).data('show');
 	  jQuery(target).children().addClass('hide');
	  jQuery(show).removeClass('hide');
	});
	});
	</script>

Continue reading “Show Different Div or HTML elements while selecting different Dropdown option : JQuery and HTML”