JQuery selectors select from an html object other than from document root?
Posted
by orangebrainer
on Stack Overflow
See other posts from Stack Overflow
or by orangebrainer
Published on 2010-06-09T08:56:27Z
Indexed on
2010/06/09
9:02 UTC
Read the original article
Hit count: 172
jQuery selectors select from the document. How do I select from somewhere else other than root? Say I want to select some children from an html object.
For this
function dothis(obj)
{
$j("#tabs").removeClass();
$j("#tabs>ul").removeClass();
$j("#tabs>ul>li>a").each(function()
{
var tabNum = $j(this).attr("href").replace("#", "");
var tabContent = $j("div[id=" + tabNum + "]");
tabContent.removeClass();
$(tabContent).before("<br><h1>" +$j(this).text() + "</h1>\n" );
});
$j("#tabs>ul").each(function()
{
$j(this).empty();//remove Ul links on top
});
}
I want to reference the selectors from an html Object (obj) i passed into as argument, instead of selecting from document.
Sorry I'm pretty new to jQuery.
© Stack Overflow or respective owner