I'm trying to show/hide a div element on select change depending on values which is working fine but problem is i am using multiple select box on single page and on change all values show hide at same time . For that I do this:
jQuery(function() {
jQuery('.selector').change(function(){
jQuery('.inv').hide();
jQuery('.' + $(this).val()).show();
});
});
What I'm doing wrong? please help
try jQuery('.selector').closest( ".inv" ).hide(); as jQuery('.inv').hide(); will find everything with that class on it and hide it hence whats happening
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.