jQuery vs Stimulus

Need advice about which tool to choose?Ask the StackShare community!

jQuery

190K
66.7K
+ 1
6.6K
Stimulus

103
97
+ 1
16
Add tool

Stimulus vs jQuery: What are the differences?

Introduction

This Markdown code provides a comparison between Stimulus and jQuery, highlighting their key differences in a concise manner.

  1. Syntax and Structure: Stimulus uses a simple and declarative HTML syntax where data-action attributes are used to define behavior and data-target attributes are used to select elements. On the other hand, jQuery primarily relies on CSS-style selectors to manipulate elements and attach event handlers.

  2. Size and Performance: Stimulus is a lightweight JavaScript framework that focuses on providing structure and enhancing interactivity without adding unnecessary bloat to the codebase. It has a smaller footprint and better performance compared to jQuery, making it a preferable choice for modern web applications.

  3. Code Organization and Maintainability: Stimulus encourages developers to follow a component-based approach, allowing for better code organization and modularity. It promotes writing isolated and reusable components, which enhances code maintainability and makes it easier to work collaboratively. In contrast, jQuery code tends to be more procedural and can lead to spaghetti code if not organized properly.

  4. AJAX and Server Interactions: jQuery provides extensive support for AJAX and server interactions, with a wide range of helper methods and options for making HTTP requests and handling responses. Stimulus, however, does not include built-in AJAX functionality and encourages developers to use other libraries or frameworks specifically designed for these tasks, such as Axios or Fetch API.

  5. DOM Manipulation vs. Controllers: jQuery is primarily designed for DOM manipulation and provides a rich set of methods for selecting, modifying, and manipulating elements on the page. Stimulus, on the other hand, focuses on providing reusable controller classes that encapsulate behavior and allow for more fine-grained control over application logic. It abstracts away low-level DOM manipulation and provides a more structured approach to building interactive UI components.

  6. Browser Compatibility: jQuery has a long history and extensive cross-browser compatibility, making it a reliable choice for a wide range of projects. Stimulus, being a newer framework, has better compatibility with modern browsers. Though it can be used in older browsers with the help of polyfills, its primary focus is on providing a modern and future-proof development experience.

In summary, Stimulus offers a lightweight, component-based approach to building web applications, focusing on code organization, maintainability, and modern development practices. jQuery, on the other hand, is a more traditional and feature-rich library that excels in DOM manipulation and supports a wide range of browsers.

Decisions about jQuery and Stimulus
Hampton Catlin
VP of Engineering at Rent The Runway · | 7 upvotes · 425.1K views

Starting a new company in 2020, with a whole new stack, is a really interesting opportunity for me to look back over the last 20 years of my career with web software and make the right decision for my company.

And, I went with the most radical decision– which is to ignore "sexy" / "hype" technologies almost entirely, and go back to a stack that I first used over 15 years ago.

For my purposes, we are building a video streaming platform, where I wanted rapid customer-facing feature development, high testability, simple scaling, and ease of hiring great, experienced talent. To be clear, our web platform is NOT responsible for handling the actual bits and bytes of the video itself, that's an entirely different stack. It simply needs to manage the business rules and the customers experience of the video content.

I reviewed a lot of different technologies, but none of them seemed to fit the bill as well as Rails did! The hype train had long left the station with Rails, and the community is a little more sparse than it was previously. And, to be honest, Ruby was the language that was easiest for developers, but I find that most languages out there have adopted many of it's innovations for ease of use – or at least corrected their own.

Even with all of that, Rails still seems like the best framework for developing web applications that are no more complex than they need to be. And that's key to me, because it's very easy to go use React and Redux and GraphQL and a whole host of AWS Lamba's to power my blog... but you simply don't actually NEED that.

There are two choices I made in our stack that were new for me personally, and very different than what I would have chosen even 5 years ago.

1) Postgres - I decided to switch from MySql to Postgres for this project. I wanted to use UUID's instead of numeric primary keys, and knew I'd have a couple places where better JSON/object support would be key. Mysql remains far more popular, but almost every developer I respect has switched and preferred Postgres with a strong passion. It's not "sexy" but it's considered "better".

2) Stimulus.js - This was definitely the biggest and wildest choice to make. Stimulus is a Javascript framework by my old friend Sam Stephenson (Prototype.js, rbenv, turbolinks) and DHH, and it is a sort of radical declaration that your Javascript in the browser can be both powerful and modern AND simple. It leans heavily on the belief that HTML-is-good and that data-* attributes are good. It focuses on the actions and interactions and not on the rendering aspects. It took me a while to wrap my head around, and I still have to remind myself, that server-side-HTML is how you solve many problems with this stack, and avoid trying to re-render things just in the browser. So far, I'm happy with this choice, but it is definitely a radical departure from the current trends.

See more
Peter Schmalfeldt
Senior Software Engineer · | 9 upvotes · 63K views

I have made an extended effort to drop frameworks completely if they are not actually needed. While I still use JS Frameworks like Vue, Angular and React ( if I have too ), I see far too often devs / teams deciding to build a single page site entirely in a framework, rather than just using HTML, CSS and a little JS.

I personally feel it's important to know when a framework is a good solution, and maybe when it's overkill.

See more
Malek Boubakri
Web developer at Quicktext · | 0 upvote · 208.9K views

The project is a web gadget previously made using vanilla script and JQuery, It is a part of the "Quicktext" platform and offers an in-app live & customizable messaging widget. We made that remake with React eco-system and Typescript and we're so far happy with results. We gained tons of TS features, React scaling & re-usabilities capabilities and much more!

What do you think?

See more
kazi shahin
CTO at Blubird Interactive Ltd. · | 3 upvotes · 101.5K views

I've an eCommerce platform building using Laravel, MySQL and jQuery. It's working good and if anyone become interested, I just deploy the entire source cod e in environment / Hosting. This is not a good model of course. Because everyone ask for small or large amount of change and I had to do this. Imagine when there will be 100 separate deploy and I had to manage 100 separate source. So How do I make my system architecture so that I'll have a core / base source code. To make any any change / update on specific deployment, it will be theme / plugin / extension based . Also if I introduce an API layer then I could handle the Web, Mobile App and POS as well ? Is the API should be part of source code or a individual single API and all the deployment will use that API ?

See more
Manatsawin Hanmongkolchai
Chose
jQueryjQuery
over
ReactReact
in

When I started TipMe, I thought about using React frontend. At the end, plain, simple jQuery won.

I had to build this iteration of the site fast and by using jQuery I could keep using Django as a full stack development tool. One important point is Django form (combined with Django Bootstrap3) means that I don't have to reinvent form rendering again, which will be the case with React.

Over time, more interactivity seeped into the site and React components start making its way into the codebase.

I now wish the site is built using React so that I could add more user friendly interfaces easier (no more fuddling with server states) but I would still say jQuery helped me get past those early days.

See more
Get Advice from developers at your company using StackShare Enterprise. Sign up for StackShare Enterprise.
Learn More
Pros of jQuery
Pros of Stimulus
  • 1.3K
    Cross-browser
  • 957
    Dom manipulation
  • 809
    Power
  • 660
    Open source
  • 610
    Plugins
  • 459
    Easy
  • 395
    Popular
  • 350
    Feature-rich
  • 281
    Html5
  • 227
    Light weight
  • 93
    Simple
  • 84
    Great community
  • 79
    CSS3 Compliant
  • 69
    Mobile friendly
  • 67
    Fast
  • 43
    Intuitive
  • 42
    Swiss Army knife for webdev
  • 35
    Huge Community
  • 11
    Easy to learn
  • 4
    Clean code
  • 3
    Because of Ajax request :)
  • 2
    Powerful
  • 2
    Nice
  • 2
    Just awesome
  • 2
    Used everywhere
  • 1
    Improves productivity
  • 1
    Javascript
  • 1
    Easy Setup
  • 1
    Open Source, Simple, Easy Setup
  • 1
    It Just Works
  • 1
    Industry acceptance
  • 1
    Allows great manipulation of HTML and CSS
  • 1
    Widely Used
  • 1
    I love jQuery
  • 5
    No Javascript on Backend
  • 5
    Simple and easy to start with
  • 4
    Balance between Front End and BackEnd
  • 2
    Easy way to add functionality to rails views

Sign up to add or upvote prosMake informed product decisions

Cons of jQuery
Cons of Stimulus
  • 6
    Large size
  • 5
    Sometimes inconsistent API
  • 5
    Encourages DOM as primary data source
  • 2
    Live events is overly complex feature
  • 2
    Steep learning curve

Sign up to add or upvote consMake informed product decisions

- No public GitHub repository available -

What is jQuery?

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML.

What is Stimulus?

Stimulus is a JavaScript framework with modest ambitions. It doesn't seek to take over your entire front-end—in fact, it's not concerned with rendering HTML at all.

Need advice about which tool to choose?Ask the StackShare community!

What companies use jQuery?
What companies use Stimulus?
See which teams inside your own company are using jQuery or Stimulus.
Sign up for StackShare EnterpriseLearn More

Sign up to get full access to all the companiesMake informed product decisions

What tools integrate with jQuery?
What tools integrate with Stimulus?

Sign up to get full access to all the tool integrationsMake informed product decisions

Blog Posts

What are some alternatives to jQuery and Stimulus?
Bootstrap
Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.
JavaScript
JavaScript is most known as the scripting language for Web pages, but used in many non-browser environments as well such as node.js or Apache CouchDB. It is a prototype-based, multi-paradigm scripting language that is dynamic,and supports object-oriented, imperative, and functional programming styles.
React
Lots of people use React as the V in MVC. Since React makes no assumptions about the rest of your technology stack, it's easy to try it out on a small feature in an existing project.
AngularJS
AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you use good old HTML (or HAML, Jade and friends!) as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. It automatically synchronizes data from your UI (view) with your JavaScript objects (model) through 2-way data binding.
jQuery Mobile
jQuery Mobile is a HTML5-based user interface system designed to make responsive web sites and apps that are accessible on all smartphone, tablet and desktop devices.
See all alternatives