jquery - Manipulating elements after AJAX load() -


i trying manipulate elements after load them using .load(). have loading correctly, can't seem target elements within of loaded elements. seems easy, can put finger on it.

i using callback after elements load, dom seems not aware of existence?

function load_page(){     $('#page_name').load("/page-name/ .page", null, load_complete()); }  function load_complete() {     $('#page_name .book_img').addclass('hello'); } 

ok, @ now. have added...

$('#wrapper').ajaxcomplete(function() {     $('#page_name .book_img').addclass('hello'); } 

which works. there must difference between .autocomplete , callback packaged .load() function. don't because called every time ajax event finished loading, me little further down road.

anybody have better?

[edit]

i tried...

$('#wrapper').ajaxcomplete(function() {     $('#page_name .book_img').addclass('hello'); } 

which kind of nice since waits till ajax calls done before calling function. maybe way it, still seems .load() function take care of this?

looks executing callback function instead of passing load method:

function load_page(){     // $('#page_name').load("/page-name/ .page", null, load_complete());     $('#page_name').load("/page-name/ .page", null, load_complete); }  function load_complete() {     $('#page_name .book_img').addclass('hello'); } 

so being passed load method null because there no return value in load_complete


Comments

Popular posts from this blog

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

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

unicode - Are email addresses allowed to contain non-alphanumeric characters? -