javascript - Tooltips for dynamic elements -


i'm having tooltips on page

var btnarr = ["#b1", "#b2"]; var ttarr = ["submit", "clear"];  $.each(btnarr, function (i, v) {     $(btnarr[i]).prop('title', ttarr[i]);     $(v).tooltip({         text: ttarr[i]     }); }); 

how can have tooltips working dynamically created elements?

you can bind tooltip widget top-level element , use items option filter elements want show on:

$(document).tooltip({     items: ".mytooltipbuttonclass" }); 

this document or container element or multiple container elements. other alternative reinstantiate new widget each time dynamically create new button tooltip, that's in cases unnecessarily complicated

here's update on fiddle: http://jsfiddle.net/h5qbhvmc/

on side note text isn't valid option , doesn't anything. ref. list of valid options


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -