I have icons in my rich text area - icons for: link, insert image, insert column. On each button when clicked it opens a popup which the user completes the task. Each button functions like this went clicked:
onclick="$.Forms.WysiHtml5.InitEditor($(this));"
and when the click on the icon again it disappears:
onclick="$.Forms.WysiHtml5.ClosePopover($(this));"
Problem:
When i click a button and popup shows then i go click another button - another popup comes up leaving the page with two popups showing. I want it so that when i click on a button if there is a popup it will close and new popup for the clicked button will show.
Based on suggested answer below:
'<a class="btn popover_btn" href="javascript:;" title="' + locale.css.columns.insert + '"'
+ 'data-placement="top" data-popover-selector="#RichText_ColsPopover"'
+ '$(#DynamicEditorForm)on("click", ".tool", function(){add close and open stuff}); tabindex="-1"><i class="icon-th"></i></a>'
Add a event delegation to the container:
$("#container").on("click", ".tool", function(){
// Close all
// Open new one
})
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.