Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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()


It 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]


Using 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.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: