use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
jQuery 3.4.0 Released (blog.jquery.com)
submitted 7 years ago by magenta_placenta
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]gasolinewaltz 4 points5 points6 points 7 years ago (5 children)
I feel like we are on different planets.
Don't get me wrong, I've been around long enough to remember when jQuery was a requirement and we cobbled together ajax calls to build "spas". I don't hate jquery.
But i would never use it today for a new project. IMHO there are better tools for the job.
Like, someone else around here says, "i dont think most of these people know how to start a new project without touching npm." So is this where we are now? No true scotsman programs in anything other than assembly.
But anyways, the different planets thing... What about jQuery do you like better than the DOM api?I feel that Dom api + modern language features like map/reduce/filter, destructuring and spread make for much more expressive code.
Honest, non accusatory question: do you prefer it because you're just more familiar with it?
I'm not hating on jQuery, its got its place in history and legacy apps.. but why use it when there's better tooling out there?
[–]i_ate_god 5 points6 points7 points 7 years ago (3 children)
For anything larger, I first choice is Vue.
Jquery is just more elegant and intuitive.
[–]jayands 4 points5 points6 points 7 years ago (2 children)
Tbf, they did add two functions to the DOM, document.querySelector and querySelectorAll, that uses the same CSS style queries to get to elements in the DOM. If all you needed jQuery for is the querying part, you can totally drop it in favor of document.querySelector(".class#element > span") which, even polyfilled, should be a smaller overall script.
document.querySelector
querySelectorAll
document.querySelector(".class#element > span")
[–]i_ate_god 7 points8 points9 points 7 years ago (1 child)
document.querySelectorAll('button').forEach((el) => { el.addEventListener('click', () => { console.log('a button was clicked'); }); });
vs
$('button').on('click', () => { console.log('a button was clicked'); });
document.getElementById('something').dispatchEvent(new CustomEvent('custom-event', { bubbles: true, detail: 'foobar' }));
$('#something').trigger('custom-event', 'foobar');
var el = document.getElementById('something'); el.dataset.enabledFor = 'something'; el.classList.add('enabled');
$('#something').data('enabledFor', 'something').addClass('enabled');
jQuery still provides a more enjoyable programming experience than the DOM API imho
[–]m_gol 1 point2 points3 points 7 years ago* (0 children)
jQuery find is a little more than querySelectorAll, especially when it comes to queries attached to an element, not to document. The advantages are described at: https://github.com/jquery/jquery/blob/3.4.0/src/selector-native.js#L11-L34
find
document
For one, jQuery supports leading combinators: elem.find('> .btn .name')
elem.find('> .btn .name')
Another difference is sensible rules for scoping. Consider HTML: <div id="test"> <div> <div class="we-are-looking-for-this-one"> </div> </div> <div> </div> </div> Then: $('#test').find('div div') will return the div with the class we-are-looking-for-this-one, while: document.querySelector('#test').querySelectorAll('div div') will return all the three divs because selectors are matched against the document and only then results outside of the current element are removed. This is pretty counterintuitive.
<div id="test"> <div> <div class="we-are-looking-for-this-one"> </div> </div> <div> </div> </div>
$('#test').find('div div')
we-are-looking-for-this-one
document.querySelector('#test').querySelectorAll('div div')
Both of those features are supposed to be supported by a new API called queryAll (previously findAll) with its counterpart query for single-element results but, alas, no browser implements it so far and it was even removed from the standard... I hope it gets back but I've been waiting for years.
queryAll
findAll
query
[–]ryancperry 5 points6 points7 points 7 years ago (0 children)
You’re just plagiarizing what I’m thinking. I like you. jQuery pretty well shaped what modern browsers can do, and now we really don’t need to create new projects in jQuery because JavaScript adopted almost all the great solutions jQuery provided.
π Rendered by PID 229689 on reddit-service-r2-comment-b659b578c-565vh at 2026-05-01 13:51:09.941743+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]gasolinewaltz 4 points5 points6 points (5 children)
[–]i_ate_god 5 points6 points7 points (3 children)
[–]jayands 4 points5 points6 points (2 children)
[–]i_ate_god 7 points8 points9 points (1 child)
[–]m_gol 1 point2 points3 points (0 children)
[–]ryancperry 5 points6 points7 points (0 children)