jquery - Popover from the click of the content loaded via ajax -


i have code

jquery('a[rel=popover]').popover({   html: true,   title: '',   content: function() {     .....     .....   } }).live('click', function(e) {   e.preventdefault();   ......   ...... }); 

i have link

<a rel="popover" href="#">link</a> 

my problem works fine on click link loaded when page loaded. when link loaded via ajax, popover not working.

make sure call popover after ajax callback function (success) again dynamically added element.. , instead of live() use on() delegated event

jquery.ajax({     url:.....     ...     success:function(data){         //codes appene        jquery('a[rel=popover]').popover({                html: true,                title: '',                content: function() {                .....                .....                }        });      }  });  jquery(document).on('click','a[rel=popover]', function(e) {   e.preventdefault();   ......   ...... }); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -