JQuery UI Tooltip still showing even after we remove title dynamically -
i have table cells dynamically adds/removes background-color , title on click. using jquery ui tooltip display tooltip. keeps displaying tooltip when update element , remove title.
[ here jsfiddle demonstrates problem: https://jsfiddle.net/uz34vwf5/8/ - if click cell - highlights , adds title in both tables. if move mouse on them can see basic alt text in first table, , styled tooltip in 2nd.
now click on them again remove title. in first table, can see no longer displays alt text. in 2nd, keeps displaying tooltip old title. ]
i have tried using:
$(this).tooltip('disable');
..but doesn't work.
try demo: https://jsfiddle.net/uz34vwf5/9/
instead of initializing tooltip on whole table #table2
, initialize on each of td
. , use tooltip('destroy')
, wont see old tooltips again.
like this;
$('td').click(function() { if ($(this).hasclass("clicked")) { $(this).removeclass("clicked"); $(this).attr("title", ""); $(this).tooltip('destroy'); } else { $(this).addclass("clicked"); $(this).attr("title", "whatever"); $(this).tooltip(); } }); //$('#table2').tooltip();
Comments
Post a Comment