ajax - jquery colorbox problem -


hi friends have showing data via ajax on page when ajax complete , click on view info colorbox not working show data without ajax , click on colorbox link working , opening

why javascript not working when data comes via ajax

thanks

$.ajax({   url: "remote.php?act=showcontacts&id="+id,   cache: false,   success: function(html){     $("#displaycontacts").html(html);    } });      $("#viewcontact").colorbox({width:"500px", height:"520px", iframe:true});  <a href="viewcontact.php?id=3" id="viewcontact" class="cboxelement">view details</a> 

when data comes ajax , click o view details colorbox not working not opening when put link without ajax working fine

the ajax data loaded after .colorbox() event handlers being attahced. after completed ajax call you'll need apply colorbox event handlers new element's you've loaded.

you can call .colorbox() method after completion, or check .live() or .delegate() methods.


Comments

Popular posts from this blog

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -

openssl - Load PKCS#8 binary key into Ruby -