designer, programmer at Downdijk·
Needs advice
on
JavaScriptJavaScriptjQueryjQuery
and
ReactReact
in

I use jQuery at the moment because I use it for a lot of years already, but now Bootstrap 5 decided to switch to JavaScript, I am thinking of switching to an alternative.

I use jQuery only for the DOM integration, animations and ajax calls because JavaScript calls to a class looks such a long call. I like the way of jQuery with $(document).on('click','.something',function() {});

By the way, I like to keep using HTML, PHP and Bootstrap as I do now.

READ LESS
10 upvotes·25.4K views
Replies (3)
Front-End Developer at Potfolio·
Recommends
on
JavaScript
React

I was like you two years ago, used to jquery and didn't want to switch, but if you're willing to use js frameworks in your projects(React, Vuejs...), I advise you to switch asap, and get used to normal javascript, because in the end, it's the core language, but there are some new ways in it (especially in ES6) that will make your life easier, like you can replace the document.querySelector() with $() and document.querySelectorAll() with $$(), using this line of code: const $ = e => document.querySelector(e), $$ = e => document.querySelectorAll(e); then you can select a p element just by writing: $('p'), and multiple p elements like that: $$('p'). I hope my advice helped you in any way.

READ MORE
4 upvotes·1 comment·14K views
Charley Kline
Charley Kline
·
November 12th 2021 at 3:35AM

Um, those jQuery-like calls like`$()` and `$$()` work ONLY in the dev tools console. You cannot incorporate them into the scripts that your browser itself runs. If you try that, you'll get a ReferenceError because `$` is not a defined variable.

They are handy when poking around in the DOM by hand in the console, though.

·
Reply
Recommends
on
JavaScript

Hi Adan,

Javascript has changed quite a bit in the recent years and lot of it was inspired from jquery. Now almost all modern browsers support javascript syntax everything that jquery does with few elaborate / sometimes better alternatives. So, if you like to switch, find the equivalents of what portions of jquery you use and replace those parts. Btw, jquery is still nicer sometimes with its method chaining and a lot simpler syntax - the equivalent in js may not be that sugary syntactically.

READ MORE
10 upvotes·1 comment·22.5K views
Adan van Dijk
Adan van Dijk
·
August 10th 2021 at 4:05AM

Thank you for the explanation and i think ill switch to plain JS.

·
Reply
View all (3)
Avatar of Othmane Agoulzi

Othmane Agoulzi

Front-End Developer at Potfolio