4 ms·
If you only have one element, then why does it require jQuery? Is learning this one simple API call too hard for people? document.getElementById()
by wavephorm 15y ago
If you only have one element, then why does it require jQuery?
Is learning this one simple API call too hard for people?
document.getElementById()
- statenjason 15y agoIt does more than just selecting an element. It also finds an inner element to do the burst from, grabs OuterWidth, and sets css. While it is possible to do these without jQuery, you could say that about any jQ plugin.
- deleted 15y ago[deleted]
- pippy 15y agoUsing jQuery allows for chaining, CSS selectors and a simple function call. Simply getting the width/height of an element in JavaScript is very hairy, especially when you want a cross browser solution. I agree this jQuery thing a little redundant, but the simple fact it's the defacto, it fixes cross compatibility issues and it's easy to write stuff in.