4 ms·
"I agree about IDs for JavaScript though." Would you mind elaborating on the JavaScript point? Is it for convenience with document.getElementById or something?
by evanrmurphy 16y ago
"I agree about IDs for JavaScript though."
Would you mind elaborating on the JavaScript point? Is it for convenience with document.getElementById or something?
Using jQuery, I tend to prefer class selectors the same as in my CSS.
- klochner 16y agoThere's less of a win in ajax from applying functionality on a class level - there aren't typically multiple selector boxes on the same page that all hit the same ajax callback.
- skbohra123 16y agoJquery class selector is the slowest selector, avoid them as much as possible. ID selector is the fastest. So, if your application is jquery intense, better avoid css selectors.
- ricardobeat 16y agoin modern querySelector implementations (any real browser), class look-ups are just as fast as IDs.