Imagine this simplified markup:
<div id="header">
<!-- Other things.... -->
<div id="detail">
</div>
</div>
and assume you already have this code:
var $hdr = $("#header");
Is there any speed difference for jQuery to lookup “detail” this way:
var $detail = $("#detail", $hdr);
vs
var $detail = $("#detail");
Since detail is being looked up by ID?
No, you don’t have to do that. Since id is unique in a document no need to add any other optimization.
I would go with