Reputation: 23
I have 3 to 4 buttons and when I click on 1st button –a popover –tooltip is opening & click on 2nd button tooltip is opening but the 1st button tooltip is not closing. I want close the tooltip popover when I click on the next button.
$(document).ready(function() {
$('.btn).click(function() {
$(this).find('.popover).show();
});
});
Upvotes: 1
Views: 119
Reputation: 730
Check jQuery siblings() function.
Something like
$(this).siblings().find('.popover').hide();
right after your
$(this).find('.popover').show();
should do the job.
Also check typos like
('.popover)
should be ('.popover')
Simple example https://jsfiddle.net/ex3ntia/6hj7p94g/
Upvotes: 0
Reputation: 38252
You need to hide all popover
elements before showing the targeted one, try this:
$(document).ready(function() {
$('.btn').click(function() {
//Hide All
$('.btn .popover').hide();
//Show Target
$(this).find('.popover').show();
});
});
Note:: You are missing some close '
elements on your selectors check that
Upvotes: 1