I need to find specific elements in my DOM using JQuery.
The case is:
var dialog = $(DOM.loadHTML("amc-refine", "scripts/dialogs/amc-dialog.html"));
elmts = DOM.bind(dialog);
So elmts here is a variable with the DOM elements ..
i have a table that i can access it using
$(elmts.dialogTable)
using jQuery i would like to reach nested elements inside this table .. for example i want to do the following
$('#example thead tr').each( function () {
this.insertBefore( nCloneTh, this.childNodes[0] );
} );
but i cant access my table using the # .. so can i do this:
$(elmts.dialogTable).find('thead').find('tr')
moreover, what if i want to reach also
$('#example tbody td img')
using the same $(elmts.dialogTable)
Best Regards
You should be able to still use
find, and pass the entire selector to it:You don’t need to call
findmultiple times as you have done in your example. Your example could be rewritten to just usefind('thead tr').Alternatively, you could use
elmts.dialogTableas the context in which to select: