如何将关闭按钮放在jQuery工具提示 [英] How to put close button at jquery tooltip
问题描述
我在我的网页上使用了。
因此,基本上我希望我的代码应该是这样:
$('。tooltipster-content')。on('click','.close',function(){
$('tooltipster-base')。hide();
} ;
但是,此代码在我的网页上无法正常工作。
它不工作的原因是因为您在小提琴中委托的事件不在页面上您绑定的事件。尝试以下操作:
$(document).on('click','.close',function(){
$('。tooltipster-base')。hide();
});
此外,您缺少 I've used this tooltip at my webpage. Now, I want to put a "close button" in the tooltip, so if user click on that button, the tooltip will be closed(Though that tooltip close automatically after certain of time but I need to add close button feature too). This is my tooltip: I need when user click on the close button, the tooltip will be closed. I put my testing code at jsfiddle. So, basically I hope, my code should be like this: But, this code isn't working at my webpage. The reason it is not working is because the event that you are delegating to in your fiddle is not present on the page when you're binding the event. Try the following: In addition, you were missing the 这篇关于如何将关闭按钮放在jQuery工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!。
在点击回调中的
$('。tooltipster-base')
jQuery选择器的前面。 p>
$('.tooltipster-content').on('click', '.close', function() {
$('tooltipster-base').hide();
});
$(document).on('click', '.close', function() {
$('.tooltipster-base').hide();
});
.
on the front of the $('.tooltipster-base')
jQuery selector within your bound click
callback.