Question
When should I use jQuery instead of plain JavaScript?
Answer
Some good use cases for jQuery:
- When you are likely going to use a lot of jQuery’s functionality, and not just a few of it’s methods
- When you need to build sites quickly that will be used on older browsers like IE8+
- When you need to use a specific jQuery plugin
…among others!
A lot of times, plain, also called “vanilla”, JavaScript is quick to use and will not require extra content to be loaded for something small like targeting a <div>
element. Definitely take the time to weigh the pros and cons before adding jQuery to a project.