In jQuery is there any difference between
$('.className > button')
and
$('.className').children('button')
Or are these just alternate syntaxes to get the same thing?
Not in terms of what you'll actually end up with, but the first one can be offloaded in its entirety to the browser's built-in CSS selection engine, whereas the second one requires jQuery to do more work and involves more object creation and cleanup. It's unlikely to matter unless you're doing this with a lot of elements in, say, a mousemove
handler, though, if even then...
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