Hi Folks,
I read a lot about different ways and techniques to select DOM elements with jQuery.
Among other articles, Paul Irish's 'Anti-Patterns for Performance' presentation.
it looks like there are thousands ways to select something within the DOM (syntax/functions/parameters).
quick example:
- <HTML>
- <HEAD></HEAD>
- <BODY>
- <DIV class="container">
- <DIV id="myelement"></DIV>
- </DIV>
- </BODY>
- </HTML>
$("div#myelement")
$("div.container > div#myelement")
$("div#myelement", "div.container")
$("#div.container").find("div#myelement")
.
.
.
I didn't make an ultimate performance test on all possibilitys, but what is in your oppinion the ultimate
way to select an element?
I guess $("div#myelement", "div.container") is better than $("div.container > div#myelement"), but not as
good(=fast?) as $("#div.container").find("div#myelement").
Do all of the above methods have a right to exist?