10 ms·
For those of you who are curious what drives jQuery in 2024 and beyond, you need to remember that WordPress is still more than 1/3 of the web, and the majority
by technojunkie 3y ago
For those of you who are curious what drives jQuery in 2024 and beyond, you need to remember that WordPress is still more than 1/3 of the web, and the majority of installations and so many plugins critically rely on jQuery. Yes, seriously.
Any advances to removing deprecated APIs or functions are great. jQuery will probably be around dominantly on the web for years to come.
- ecshafer 3y agoAlso, jQuery is awesome. People have been in love with the overly complex and fancy javascript frameworks for the last 15 years or so. But jQuery doing dynamic binding to dynamically generated forms for some error states and maybe an ajax calls is literally all the javascript you need in 99% of web pages and the rest is overkill. The industry is going to move away from the complexities to React and towards more of this simplicity with htmx, phoenix live view, ruby on rails turbo, and yes just jQuery.
- holoduke 3y agoYou still need some kind of application framework. Jquery is just a low level utility. But higher level you need to maintain architecture. Specially in spa's
- hnfong 3y agoYou don't "need" an application framework. People have been building websites (even SPAs) before the 2010s and they didn't "need" these frameworks. Given what we know today, I'll grant you that in some cases people would want to use a framework, but it's hardly a necessity unless the context provides more specific requirements.
- agos 3y agoyou don't "need" a framework for backend development, too, but most people find it highly convenient
- holoduke 3y agoIts can be convenient to have some kind of reusable conponents. Like listviews wtih certain functionality. Same for routing. Caching etc.
- claytongulick 3y agoNative web components / custom elements work great for this.
- holoduke 3y agoSo you end up with an component framework.
- bdhcuidbebe 3y agoYou dont ”need” anything. But most people prefer some organization, familiarity and reusability, and not having to reinvent the wheel in every project they start.
- bufferoverflow 3y agojQuery is not awesome. It was awesome 15 years ago. Now it's completely outdated. It's very hard to reason about DOM that can be manually changed by any random piece of code. That's why declarative solutions like React/Vue/Svelte are so much better.
- rjbwork 3y ago>It's very hard to reason about DOM I don't mean to be overly snarky here, but as someone who's just totally out of their depth in modern web UI - is that why people like these frameworks? Because they're very easy to reason about? I've generally found them to be mountains and mountains of boilerplate and spaghetti, but I really do not have a wide base of experience to pull from on this topic.
- auxfil 3y ago[dead]
- christophilus 3y agoThat's one of the reasons I like them, yes. I've done a lot of manual DOM manipulation, and a lot of jQuery. When you're building anything complex, it starts to become quite difficult to figure out why a particular piece of the DOM is behaving the way it is. It could be an overly aggressive selector that accidentally targeted it, or any number of things. Prior to React (and similar libraries), DOM manipulation was generally done in a mutating, effectful way. With React (and similar), if a thing is behaving strangely, I just need to go to the component that rendered said thing, and I can almost always find the problem.
- Capricorn2481 3y agoI started with Jquery, I learned React. I prefer React. React complexity is often conflated with things like Next JS or other SPA solutions. React was originally meant to be a library for building small components that you drop into an otherwise static websites. But people usually don't talk about React unless they're talking about whole sites being in React. For that reason, I think its complexity is exaggerated. More importantly, what the commenter is referring to is the fact that you are encouraged to write Jquery code that can break if you decide to move a div or change a class name. The workflow of CSS selectors is fine for small apps, but can lead to hard to track bugs down the road. It can be avoided if you make a lot of unique IDs. But otherwise you're screwed. There's no scoping. You technically have to read every piece of Jquery code before changing any other code, html, or css, because you could break half the site depending on what people were depending on. There's no IDE support telling you what is selecting what. Events are not colocated on the things they attach to, they could be anywhere. I can update a React component and be sure that the only places it affects are the places its rendered. And I can get type checking on every input going into a component. That's just way better to me. I still use JQuery at work, but I usually dread it. And people say JQuery is "smaller" but I would still prefer something like Svelte to Jquery if that's a concern. I can take or leave Vue, I don't really notice a huge difference between it and other component frameworks.
- tipiirai 3y agoSecond to that: jQuery is awesome. Or more specifically: the idea that websites can be built with vanilla HTML, CSS, and _optional_ JS. jQuery embraces progressive enhancement and separation of concerns pattern, which is quite the opposite of how websites are built these days. Web development starts with 10+ React import statements for components, CSS, images, and whatnot. JavaScript is a must, not optional.
- p-e-w 3y agoOne website that almost always gets mentioned when people talk about jQuery today is "You might not need jQuery" (https://youmightnotneedjquery.com/ https://youmightnotneedjquery.com/). That site is the best ad for jQuery I've ever seen. For almost every task it describes, the jQuery code is shorter, cleaner, and more intuitive than the vanilla "modern" JS one. And that's after almost 20 years, and I don't know how many billions of dollars invested into advancing JavaScript.
- tipiirai 3y agoIt's the jQuery API design. I often find myself creating functions like this one: export function $(query, root=document) { ... } jQuery acted as a role model for standard web committees. The argument for querySelector / querySelectorAll calls is literally mimicked from John Resig's groundbreaking API design.
- cxr 3y ago[flagged]
- tipiirai 3y agoAbsolutely yes. jQuery selector engine was developed before the official Selector API, which ended up being almost exactly the same. Except for a few exceptions which John wasn't too sure about when they asked for feedback: https://johnresig.com/blog/thoughts-on-queryselectorall/ https://johnresig.com/blog/thoughts-on-queryselectorall/
- rdedev 3y agoI'm not a web developer but sometimes I have to make a page with some JS functionality. jQuery saves me a lot of time in such cases
- esaym 3y ago>But jQuery doing dynamic binding to dynamically generated forms Do you have an example of that?
- DonHopkins 3y agoHold my beer! https://alive22-dev.turnaroundhealth.com/static/javascript/questionnaire.jquery.js https://alive22-dev.turnaroundhealth.com/static/javascript/q...
- ourmandave 3y agoMore that one line, doesn't count! =D
- DonHopkins 3y agoIt's one line when minimized! ;)
- cxr 3y ago[flagged]
- worthless-trash 3y agoI think your definitive comment above 'absolutely not' has tainted how people see your authoritatively spoken statements.
- deleted 3y ago[deleted]
- cxr 3y agoOkay?
- erhaetherth 3y agoIf you don't want to use a big framework, then you needn't use any library at all. Nearly everything in jQuery is 1 line of modern JS, no?
- colordrops 3y agoYes, there isn't much reason to use jQuery these days other than keeping with the idioms of a legacy system.
- deleted 3y ago[deleted]
- pier25 3y agoOne line of jQuery can replace many lines of vanilla js.
- troupo 3y agoNearly everything in jQuery is more concise, consistent and composable compared to modern JS APIs. As this site clearly shows: https://youmightnotneedjquery.com/ https://youmightnotneedjquery.com/
- deleted 3y ago[deleted]
- masklinn 3y ago> Nearly everything in jQuery is 1 line of modern JS, no? Since JavaScript never actually requires line breaks, yes. Otherwise, absolutely not. Modern web APIs remain highly statements-based, with little affordance for pipelining / cascading.
- krick 3y agoI won't dare to predict where industry "is going to move", since I'm not really a frontend developer, so what do I know anyway (and especially since it seems to switch directions every couple of years, and mostly being pulled in all directions simultaneously). But personally I still prefer to use stand-alone JS-scripts and libs included directly into the page, if I can. Mostly because I hate having to deal with complicated (and, importantly, rather slow) build process just for the sake of a couple of web-pages, when the real stuff is some totally invisible backend processing or maybe some sort of HTTP API to be used by other services. Also, honestly, I really just don't know what's the "correct" way to do things in 2024 on frontend, and I don't know where to even look for a guide, if I don't really want to spend next 6 months entirely in the pursuit of attaining "real" frontend-dev proficiency, but ultimately just to make working stuff, even if it doesn't quite follow the v2024 web-etiquette.
- palmfacehn 3y ago"Etiquette" implies there is some civilizing force. A system that allows us to coexist in peaceful, accessible sanity. Someone said of a profitable app/site I created with vanilla JS, "But this is looks like it is just a Bootstrap site" At this point, functionality be damned, customers expect a loading spinner. The norm is something that doesn't load on the first request. Sites don't paint the screen until 10 seconds later, because they are avoiding repaints. Maybe 10-20mb of JS is included in the typical app in this niche. Many totally fail on Firefox. Ambiguous user facing errors on a black screen, "An application client side error occurred" are par for the course.
- webworker 3y agoI keep saying this. At some point, some very smart people are going to figure out how expensive React is to build and maintain, and it’s going to change the conversation.
- falsandtru 3y agojQuery remains the best JSONP library. It can get data even when other libraries are blocked.
- rolisz 3y agoIf I understand this announcement correctly, they removed support for JSONP
- falsandtru 3y agoJust removed "Automatic" JSONP "promotion". JSONP is still available.
- patrickaljord 3y agojQuery is amazing, still remember the joy of using it 20 years ago. That being said, React, Vue and similar are just better IMO to build and maintain complex apps. Don't get me wrong, jQuery was the best thing at its time and I will always be grateful to its contributors, but today there are better alternatives. I think htmx is nice but not seeing it taking over other frameworks.
- linkjuice4all 3y agoDefinitely agree that the modern frameworks are better for complex stuff. Ideally there’s not really a middle ground - you’re either doing complex interactive “app-like” stuff with a framework or adding modest dynamic features to otherwise static content (e.g. static export of WordPress with some jQuery for your forms).
- throwaway2990 3y agolol react. Never seen a good react project. They all end up a mess.
- yashg 3y agoYup, jQuery is indeed awesome!
- khasan222 3y agoI’ve been writing JavaScript for 15 years professionally, and I must say this comment seems to be made by someone not as familiar with the context here. Moving away from React and frameworks like it would require a radical rethinking of what we expect to do with web apps. Building something like google maps, google docs, figma, are definitely doable with some of these tools, but it is almost impossible to maintain. This comment truly ignore the context of why frameworks like react took off. Jquery is great if you need a slideshow on a page, and maybe just some tracking, and even then, I’ve recently opted to just use vanilla js, with things like webpack build targeting whatever versions I would need. JavaScript programming is complex because making great ux can be a non trivial task. Please excuse any typos, written on the phone
- heartbreak 3y agoHow many React apps actually have an interface approaching the complexity of Figma or even Facebook? No one is arguing that complex web applications don’t benefit from React and friends. It’s completely overkill for most of the web.
- anthonypasq 3y agowhy does everyone have this impression that people are using react to render a website that is 5 divs and some images, like where is this perception coming from? do you have any examples at all? any website that has any sort of meaningful functionality and communication with a server is mostly likely using some sort of framework.
- docmars 3y agoAgreed. There is a _lot_ of naivety around how these frameworks are perceived, from people who have never used them, or who come from different programming backgrounds (i.e. not frontend). It's amusing.
- hombre_fatal 3y agoYeah, there's this whole meme on HN where React competes with hand-writing the HTML of your three-page brochure website, a website virtually nobody is building.
- lucsky 3y agoNo, the "industry" is not going to move away from React (or Vue or Solid or Svelte), but idiots on HackerNews (and Reddit and Twitter and Mastodon, etc) might finally stop conflating web SITES and web APPS. One can dream.
- spillguard 3y agoFrom the guidelines: "Be kind. Don't be snarky. Converse curiously; don't cross-examine. Edit out swipes."
- lucsky 3y agoYou're right, this was 100% sent out of frustration and I probably shouldn't have. I still think that the level of nonsense in this comment section is of galactic proportion though.
- cphoover 3y agoAgreed...Another gripe... the amount of people on HN complaining that a web-app doesn't 'work without JS, when the number of user's who disable JS inside their browser is well under 1%. HN users don't even consider they are not in anyway typical web users.
- dagss 3y agoUnpoly too (very similar to htmx but the small difference makes it a lot more convenient I feel, I wonder why Unpoly isn't getting as much traction as htmx)
- docmars 3y agoOrganizing a large jQuery project is absolute hell though. I'll take modern frameworks like Vue any day. The ease of shipping a full-fledged app that feels easy to create and maintain began with Vue (and Svelte). React tries to achieve the same result, but if you don't use it perfectly right, you're in for hours and hours of headaches and non-solutions.
- pjmlp 3y agoFully agree, jQuery + Bootstrap + standard Web + SSR, and we're gold.
- silent_cal 3y agoI read that the JS fetch API makes jQuery obsolete, is that not true?
- Onavo 3y agoThey just need to add JSX support. Half the reason people use react is because of JSX.
- IgorPartola 3y agoMaybe unpopular opinion but JSX is inferior to something like the Vue templating system. I much prefer to have HTML with some JS sprinkled in than JS that looks like HTML but isn’t.
- TheMajor 3y agoMost of us devs had "separation of concerns is critical" drilled into us for many, many years. For that reason alone, JSX just gives me the baddest of smells when I look at it.
- troupo 3y agoThis way of looking at separation of concerns helps: https://x.com/simonswiss/status/1664736786671869952 https://x.com/simonswiss/status/1664736786671869952
- mardifoufs 3y agoHow does jsx not have separation of concerns? I get what you are referring to but that's not SoC as I know it
- Klathmon 3y agoAnd to wage this holy war a little, I personally much prefer JSX over a templating system that looks like html attributes but acts different, while trying to act like javascript but can't. Honestly at the end of the day they both get the job done, but for me personally working in JSX is just so easy to pickup and use, and while it's not perfect, I do prefer it over having to learn yet another library specific templating kinda-sorta language.
- troupo 3y ago> I much prefer to have HTML with some JS sprinkled That's not what vue templates are. It's three or four different templating DSLs in one. v-for alone will show that it's not HTML with Javascript: https://news.ycombinator.com/item?id=28059397 https://news.ycombinator.com/item?id=28059397 And there's more: https://news.ycombinator.com/item?id=19199423 https://news.ycombinator.com/item?id=19199423
- thedangler 3y agoI remember switching from mootools to jQuery back in 2006ish. Thought it was fantastic. Awesome it’s still around. We still use it from Time to time.
- kentf 3y agoDon't forget Prototype (http://prototypejs.org/ http://prototypejs.org/)
- slater 3y agoand scriptaculous! http://script.aculo.us/ http://script.aculo.us/
- quickthrower2 3y agoYUI https://clarle.github.io/yui3/ https://clarle.github.io/yui3/ Do we need to get into underscore etc?
- andrew_ 3y agoAnd Dojo! https://dojotoolkit.org/ https://dojotoolkit.org/
- jkingsman 3y agoOh man, back in the day I got my first exposure to big, enterprise web apps in the form of an undergrad internship on a control panel for a major database that ran on Dojo. Every time I could scurry back to Python to work on a backend feature, I breathed a sigh of relief. It put me off frontend for a long time until I arrived at a shop that taught better, and not being taught was definitely a big part of my fear of Dojo/frontend dev, but Dojo is also BIG and you can build some really unwieldy systems with it. You can do that with any framework, sure, but in the heyday of Dojo, it was a lot of opaque logic that wasn't as well doc'd out or understandable just by reading as today. Dojo put the fear (respectful) and fear (scared) of big, enterprise frontend development in me.
- 3y ago
- quickthrower2 3y agoThe fact that it, well, works doesn’t help with the React world domination either.
- emseetech 3y agoWordpress devs are the plumbers of the tech industry. It’s not glamorous work but there’s a ton of money in it because so many people need them. If I ever decide to retire from latest and greatest hype cycle big tech startup world, I’ll go build Wordpress sites for honest coin and wrap up every day by 3pm.
- TheMajor 3y agoThe fact that Wordpress runs so much of the web sometimes wakes me in a cold sweat. If you're a dev worth their salt and knows proven engineering and design patterns, then Wordpress code is absolutely terrifying to look through.
- Zetobal 3y agoSee comments like yours do that for me. I will see you in the 30 meetings needed for the new form on the contact page.
- junaru 3y agoComments like yours do that for me. Every day we suspend several WP sites for failing to put basic captcha on their contacts page that results in the form being abused for email bombing. Maybe on meeting 27 they will put the damn thing on and save themselves the headache of getting out of RBLs. If theres one thing WP developers cant write its contact forms! :) P.S. Wordpress is fine in general.
- radium3d 3y agoheh, try 11-12pm. o.O
- irjustin 3y agojQuery will always hold a special place in my heart. It made absolutely terrible APIs usable and help abstract away a lot of the different browser issues. While I do a lot of effort to stay off jQuery these days, every time I have a library that ends up using jQuery its always intuitive to use.
- krick 3y agoHonestly, though, given more sophisticated browser-native selectors were implemented way after jQuery was, I wonder why didn't they just make at least somewhat jQuery-compatible API. It's just way simpler.
- thr0waway001 3y agoI don't care what anyone says, jQuery still rocks and is so damn important and influential. You remove jQuery from every piece of software a good chunk of the all the websites stop working all around the Internet.
- TheMajor 3y agoYup, hard truths: vanilla JS is far less readable and clunkier than just using jQuery to do the same thing. Also, not everyone needs or wants to move to a shadow DOM framework with a zillion components and high complexity. If you're building a SPA or PWA, yes, absolutely, but for the vast majority of us who use a traditional backend/CMS-driven site with server-side rendering where client-side interactivity is needed, jQuery still does the job really nicely.
- KTibow 3y agoNow I might not know what I'm missing out on since I haven't worked in any projects w/ jQuery as I haven't been developing websites for a long time (and the type of sites I make probably also influences the stack), but there's probably something that does what you want as elegantly without jQuery. We have stuff like querySelector and toggle in vanilla JS that makes it possible to change state simply, async stuff is much easier to understand than callbacks, and there are ways to split your code into components without using shadow or virtual DOM (see: raw web components, shadowdomless Lit, Svelte, etc). I've never found myself longing for something like jQuery.
- skydhash 3y agoIf you're creating a fully interactive webapp (google maps, docs, or apple music), go with one of the frontend frameworks because they will give you a much simpler way of managing states and binding it to the view layer. But the majority of websites are not apps or shouldn't be. You'd only have a couple of interactive elements if you strip the UX to its core. And that can be done easily with server rendered templates and a bit of jquery/vanilla js.
- 3y ago
- tambourine_man 3y ago>…WordPress is still more than 1/3 of the web… Why still? WordPress, like jQuery, is awesome. It's an incredibly powerful and easy open source CMS. I hope it takes more of the Web. And if you're gonna defend the decentralization of the Web (and I do), it's hard to find a better argument than “just buy a domain and install WordPress”.
- PrimeMcFly 3y agoIt's a buggy insecure mess. No one should be advocating for wordpress.
- tambourine_man 3y agoI’d like to know the name of this alternative that’s as feature-rich and yet bullet-proof while still being open source
- rastographics 3y agoit's called processwire and once I found it I never looked back
- PrimeMcFly 3y agoDjango and Wagtail is one option. Do a little research and you'll find others.
- vdaea 3y agoNeither are written in PHP so they don't work on most cheap hostings.
- PrimeMcFly 3y agoYou can get a kimsufi server for $6/month, and there is plenty of cheap hosting offering django, pretty sure you can even find python hosting for free up until a point.
- lostemptations5 3y agojQuery is just way cooler than the comparatively build in (and sometimes obtuse) web standard replacements for it.
- todotask 3y agoNow we have React, React DOM and jQuery in WordPress.
- noduerme 3y agoI was going to post on HN not long ago and didn't, about how I still can't find a great event chain handling / bubbling model that lets me use both DOM members and abstract class instances to trigger interchangeable events. I've built my own event dispatchers here and there, but jQuery just does everything right. Although event handling is almost the only thing I still use jQuery for, it's so useful that I still include it in almost every client-side project. The reason I was going to post was to ask if anyone knew of a slim library that could both $(window).trigger('click') and $(myClassInstance).trigger('myCustomEvent',{data}) with the same API for listening to either one asynchronously. With the rise of fetch() and css selectors I could probably do without the rest of jQuery at this point. But why reinvent the wheel? And before anyone tells me that having class instances dispatch events is a code smell... it's absolutely necessary if you want to build responsive frameworks from scratch. [Just for example, my base component class listens for a particular custom resize event dispatched from the screen that contains it, which only dispatches to components on screens that don't scroll and need to reformat their contents. The screen class listens for window.resize but only dispatches if it's in trouble with the layout. Putting individual DOM resize listeners to window on each and every component would be insane.]
- claytongulick 3y agoIf your class instances are attached to the DOM somehow, you may be looking for CustomEvents? document.querySelector('#something').dispatchEvent( new CustomEvent('myCustomEvent', {...options}) ); and document.querySelector('#something-else').addEventListener('myCustomEvent', () => {...}); You don't even need CustomEvents if you don't need to carry extra data with the event. You can just do new Event('myCustomEvent') and dispatch it. For triggering 'click' events and such, you can create and dispatch native events, as described here [1]. More verbose than jquery, like most native DOM APIs, but works well. If you're not dealing with a DOM element and just need to dispatch/listen from a class, try out EventTarget [2]? Your class can inherit from EventTarget, and it gets dispatchEvent and addEventListener, just like a DOM element and you can use any of the above things with it: class Test extends EventTarget { ... } let foo = new Test(); foo.dispatchEvent(...); [1] https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events https://developer.mozilla.org/en-US/docs/Web/Events/Creating... [2] https://developer.mozilla.org/en-US/docs/Web/API/EventTarget https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
- profmonocle 3y agoIt's not just WordPress. A company I used to work for has tens of thousands of lines of jQuery code powering their enterprise SAAS product. A rewrite in a modern JS framework is just not going to happen unless it becomes absolutely necessary. Much of this code is extremely client-specific stuff written over a decade ago. The argument that using a modern framework helps recruiting doesn't work - the company only pays $75-90k for frontend engineers and has very low turnover, most current engineers have been there 5+ years. And most importantly, their current stack works just fine; they have a bunch of long-time clients who are happy. A good chunk of software engineering happens in "boring" businesses like this in cities with a much lower cost-of-living than the big tech industry hubs like the Bay Area / Seattle / etc.
- sanitycheck 3y agoThe other problem with a "rewrite in a modern JS framework" is that when it's finally done it'll only be a few more years until it needs another "rewrite in a modern JS framework". And that's worse, because at least with JQuery it just stays the same whereas with anything in the NPM ecosystem using anything older than, say, 6 months is kind of a nightmare in terms of dependencies and tooling. Not broke? Don't fix!
- mardifoufs 3y ago1/3 of the web does not mean much. Are you referring to web usage or just the number of web pages?
- seydor 3y agoweb pages and it does matter a lot. Among others, Woocommerce runs 23.43% of e-commerce.
- 5350-uiop-1130 3y ago> Any advances to removing deprecated APIs or functions are great. if something is used, it has value. it's not deprecated.
- seydor 3y agoA lot of us are using it actively. It's so lightweight now that it s free, and it s somewhat better than vanilla js.
- kamaal 3y agoAnd many many company internal tools, that won't be rewritten and just get replaced with something better(ReactJS?) over time. It would be around for long is nice, but you can't make a career using it these days. jquery, perl just some of those insanely useful tools which get the work done, but they don't pay you well these days.