What the better way to select an element inside another:
var elem = $('#container').find('ul');
var elem = $('#container ul');
var elem = $('ul', '#container');
Any thoughts?
What the better way to select an element inside another:
var elem = $('#container').find('ul');
var elem = $('#container ul');
var elem = $('ul', '#container');
Any thoughts?
The answer use to be The shorter the better
. However, when benchmarking this, using jQuery here it doesn't make any significative difference. Anyways, I find this pretty and more concise:
var elem = $('#container ul');