javascript - Tooltipster plugin not firing jquery function when button or any click even occur -


i want use tooltipster plugin click element in body show tooltip , want have close button inside tooltip close it.

however use jquery click() function handle won't fired. tried solution in post. worked when tooltip triggered hover event.

tooltipster plugin not firing jquery function when link in in tooltip clicked

the original solution using hover in jsfiddle

trigger: 'hover', 

instead using click show tooltip

trigger: 'click', 

http://jsfiddle.net/bcqyl/7/

it won't fire click event in jquery block. can captured normal javascript function only. checked should code in tooltipster plugin locked , captured "click()" event inside tips when in click trigger mode.

i tried other event onchange event of radio button fired when using code in original solution

@evan right. tooltip doesn't exist in dom , can't bind/delegate action (even if go way $(document) after domready).

if you're after close button inside of tooltip try following code, it's worked me (and jsfiddle!):

javascript

$('.tooltip').tooltipster({     // required, have fiddle around     'interactive': true,     'contentashtml': true,     'autoclose': true,     'trigger': 'click',     'onlyone': true,      // ...      // coup de grĂ¢ce ...     'functionready': function(){         $('.tooltipster-default .close').on('click', function(e){             e.preventdefault();             $('body').click();         });     } }); 

html

<span class="tooltip" title="<h3>title <a title='close' href='#' class='close'></a></h3><p>this tooltip content!">i have tooltip!</span> 

the jsfiddle

http://jsfiddle.net/hpkst/1/

why works

the combination of autoclose , trigger in closing tooltip whenever person clicks outside interactive tooltip. functionready callback allows bind function take advantage of , delegate function click body while tooltipster open, closing tooltip.

i hope helps! :)


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -