Avatar of mike99c
 asked on

Should I still continue using JQuery for Bootstrap 5 when it's no longer a requirement?

The latest Bootstrap 5 version is designed to no longer depend on JQuery but you can still use it. In the Bootstrap website they encourage you to use vanilla JavaScript.

I have always used JQuery in my previous Bootstrap versions and am in two minds about switching to vanilla JavaScript and abandoning JQuery altogether.

I understand that the main advantage is that you save around 85k by not importing the JQuery library but the trade-off is the code is not as easy to read. I am also concerned that I still depend on plug-ins such as Fancybox which depend on JQuery so I would have to import it anyway.

I would like your views on the best approach going forward based on what I have written.


Avatar of undefined
Last Comment
Miguel Oz

8/22/2022 - Mon
David H.H.Lee

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
David Favor

Where JQuery is concerned... generally speaking...

1) You'll either use JQuery where this makes sense... or...

2) Write your own JQuery replacement code, which will almost surely work slower, less correctly, with far larger sized code than using JQuery.

There is no right or wrong.

You'll have to make this choice based on your own criteria for robustness of your code.

In almost every case, JQuery code (1000s of developers) will be far more robust code than any single person can write.


I just bought my first  Bootstrap 5 template with no JS dependencies.

What I have realized with this, this is using very old JS to achieve the usual  jQuery stuff
 most are old JS, no longer maintained and maybe not secure.

So the template is a bit buggy because of this.

So I added jQuery to be able to use more robust plugins.

For a web application I would use jQuery for sure.

Maybe we are in a new turn, big players try to change the trend but sometimes the dev just don't  follow  ...


Miguel Oz

It depends what you use in your website. For example is you  use Angular, you can use Bootstrap 5 without using JQuery as most of the Angular libraries do not require JQuery.

JQUERY is only required if you needed as prerequisite for other libraries or you still want to use the query syntax:

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes