tags:

views:

148

answers:

2

I am working on loading a HTML table snippet into a page via jQuery Load.

When this snippet is loaded into the page will i be able to manipulate the table with jQuery or is it just treated as a string?

When i say manipulate i have onClick events on table columns that need to fire.

+4  A: 

If you insert your loaded snippet into the page (which is pretty much automatic in jQuery's load()), it will become part of the DOM, and can be treated exactly like any HTML element that was originally on the page.

Max Shawabkeh
but beware, the events you bound before the load will not apply to this new DOM part. to get this behavior you need to use live events see http://api.jquery.com/live/
marc.d
Yes i did some POC work with and without using the .live() method and it works great!Thanks to you all.
RyanP13
+1  A: 

Oh, and make sure that your events are binded after the new elements are loaded into the DOM. Else, have a look at the live function.

Adhip Gupta
I think all the events are attached to the HTML itself of the newly loaded controls.
rahul