javascript - Identifying Jquery Selector -
i'm new javascript , jquery.
what selector mean: " #layoutcolumn2 > div > div > div > ul"
contect (the function comes from):
function loadnexttier(tierid, changeditemvalue) { linkarray.length = 0; $("#placeholderforload").load(changeditemvalue + " #layoutcolumn2 > div > div > div > ul", function(){ $("#placeholderforload li").each(function(){ var itemname = $(this).children("a").text(); var itemvalue = $(this).children("a").attr("href"); linkarray.push(itemvalue+";"+itemname); }); if (tierid == "tier1") { tierid = "tier2"; } else if (tierid == "tier2"){ tierid = "tier3"; } else if (tierid == "tier3") { tierid = "tier4"; } resettiers(tierid); fillmylist(linkarray, tierid); });
it match following structure
<any_tag id="layoutcolumn2"> <div> <div> <div> <ul> <-- matches tag <li> <ul> <-- doesn't match. fetched children, not descendants #layoutcolumn2 > div > div > div > ul means:
get
<ul>child of<div>, child of<div>, child of<div>, child of tag id oflayoutcolumn.
by way, term descendant means element comes nested (no matter how deep) in element. css selectors, without combinators, target descendants.
the term child or children means elements direct descendants or descendants 1 level deep element. that's purpose of >.
Comments
Post a Comment