Search code examples
jquerytooltip

Applying Jquery to Html elements inside a tooltip


I'm using tooltipster to display tooltips.

In the content of tooltipster,I want to display a checkbox

But the real problem is that I want to popup a alert box when a user clicks on the checkbox.But I'm unable to do so.I have tried using jquery change() method on the checkbox,but it doesn't help. Can anyone suggest me a way to apply jquery on the check box?


Solution

  • Tooltipster dynamically appends html. therefore, you need to tell jquery to check condition live. This is done by delegate

    Check this example:

    $( "table" ).delegate( "td", "click", function() {
      $( this ).toggleClass( "chosen" );
    });
    

    Even if any script dynamically add new TD to the TABLE delegate will still work.