Is $('selector', element) the same as element.find('selector')?
I was looking this post about 开发者_如何学编程best practices of jquery jquery-pitfalls-to-avoid in one of the answers someone said about the good uses of context in a selector and quotes a examples like this
var ct = $('#container');
$('.myClass',ct)
With the finally to explain that this will find in the context of the container
and not in all the document. Now my question if that code is not the same that this function
var ct = $('#container');
ct.find('.myClass')
It is exactly the same. In fact, the first version delegates to the second (making the second slightly faster).
I'm pretty sure you can just use
var ct = $('#container .myClass');
精彩评论