Topic: Popover close all on page
ciscom pro asked 5 years ago
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.
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.
}
Tomek Makowski staff answered 5 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
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: 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