re: I Need jQuery VIEW POST

VIEW FULL DISCUSSION
 

I Need jQuery

No, you don't. You can find it useful, and that's fine. It makes you feel more comfortable with front-end coding. Another perfectly valid reason.

But you don't need jQuery.

Also, looking at your examples, I find that maybe jQuery has prevented you to consider some recent but common new features in browsers. For example:

In native, You can't set multiple styles to element at once.

Sure you can. Consider this:

Object.assign(element.style, {
  'background-color': '#000000',
  'color': '#ffffff'
});

More than that, you must be aware of what jQuery does for every operation. It creates a collection, attaches its methods, bindings and callbacks. It performs its checks. It has a cost. And everyone should be aware of that.

That's why it's wrong to compare .hide() to simply setting .style.display = 'none': in fact, the former does much more than the latter, and should generally be avoided.

In native, element getter methods has too many kinds and has too long name.

This is a non-issue, as you can use a plethora of tools that help you writing your code with intellisense and the like.

Anyway, performing DOM operations should be hardly be an issue nowadays. You should concentrate on the structure of your application, and jQuery doesn't help in that sense.

All in all, we still have to deal with legacy code that has to maintained, and jQuery is ubiquitous there. So, should I know jQuery? Absolutely. Should I start a project using jQuery? If it's not just a simple landing page, no.

code of conduct - report abuse