$('#content td#foo').show(); $('td#foo').show();
The td is somewhere deep in the content div.
What is faster?
ID and Element selector are the fastest selectors in jQuery.
Locating elements by id is faster than css. Because : id of an elements is more specific than css of an element.
popupbutton is the fastest.
$("#myId) The document. getElementbyId( "myId") is faster because its direct call to JavaScript engine. jQuery is a wrapper that normalizes DOM manipulation in a way that works consistently in every major browser.
You can simply write
$("#foo").show();
You cannot have more than 1 elements with the same id. So no need to use any additional selector to get an element with a particular id. So your td tag selector can be avoided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With