Topic: Popover close all on page
How can I close all popovers on a page? I want to do this on button click but I do not know the id of the popover as it's in asp.net update panel and repeater. I have tried adding a class (pophide) to the popovers and then $('.pophide').popover('hide'); but this doesn't work.
TomekMakowski staff answered 6 years ago
Hi
If you want to hide all popovers, you must choose all elements which have popovers to show and then use .popover('hide')
(e.g. $(".elements").popover("hide")
). If you want more help please show me your code in snippet.
Regards
Tomek
ciscom pro answered 5 years ago
Thanks Tomek, I was on the right lines. I just needed to do this for all items in my repeater. I am opening and close the popup from c# code. Now it works. Hope this helps someone else:
protected void ClosePopovers()
{
var autoRunScript = "$('.popover').popover('hide');";
ScriptManager.RegisterStartupScript(Page, GetType(), "popoverclose", autoRunScript, true);
}
and then in my repeater
foreach (RepeaterItem item in RepeaterQuestions.Items)
{
ClosePopovers(); ... etc.
}
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.7.6
- Device: PC
- Browser: Chrome
- OS: Win10
- Provided sample code: No
- Provided link: No