Because you're adding the execution overhead of MULTIPLE function and method calls. Because it encourages you to get that element every joe-blasted time you want to do something with it instead of storing a reference in the appropriate scope.

The code bloat of the train wreck of developer incompetence that is jQuery does not balance out with any ALLEGED savings it provides.

Hence why everything I've seen done in jQuery falls into one of three categories.

1) Things that are none of JavaScript's business and are instead HTML and CSS' job.

2) Things that could be done in a fraction the code without jQuery WITHOUT counting the size of jQuery against it.

3) inaccessible crap that has ZERO business on a website in the first place, and in certain industries could land your arse in court for WCAG violations under laws like the US ADA and UK's EQA...

... and that last one applies to most front-end frameworks including such gems of derpitude as React, vue, angular, bootstrap, tailwind, etc.

Don't believe me on the legal front? Ask Domino's and Beyonce.

Written by

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store