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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -