Issue
I want to know how to show one element after I select option from one select and then select option from another select. If I have 2 selected options the div need to show, else to hide. I tried this, but it is not working. How can I do it with change function or something else ? Thanks.
if ($('select.one option').is(':selected') && $('select.two option').is(':selected')) {
jQuery('.box').show();
} else {
jQuery('.box').hide();
}
Solution
You need to wrap your code in a "change" event listener.
There are several ways of doing it, but this should work fine.
$('select.one').change(function() {
if ($('select.one option').is(':selected') && $('select.two option').is(':selected')) {
$('.box').show();
} else {
$('.box').hide();
}
});
Answered By - MikeChav
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.