Hacker News new | ask | show | jobs
by Carpetsmoker 2690 days ago
I think jQuery is a good option if you're making "rich applications"; that is, normal HTML pages with some JavaScript for better UX. For many applications this is still a good approach.

If you're making an SPA, then jQuery is a bad choice for many reasons. jQuery is just a DOM wrapper, and doesn't give you any application structure, which tends to lead to pretty messy applications.

2 comments

I believe Vue.js is much better option for this use case (just enhancing UX on an existing HTML page), and is similar in size while giving you much more flexibility.
I only looked at VueJS for about an hour, but it's my impression that Vue.js is much more of an application framework for SPAs than "rich HTML"? Quickly looking at the "getting started" guide doesn't give me the impression that it will work well if JavaScript is disabled?

What I want is just intercept some (but not all) form submissions and load the results via AJAX, and such.

You can just use DOM templates with Vue.js. Basically write your HTML the way you normally would and add the Vue.js attributes that tells Vue what to bind with. If JavaScript is disabled you just have plain HTML. It does scale up to doing a full SPA with single file components and compiled templates with Webpack.

Here's a simple form example:

https://jsfiddle.net/ufowkr92/

jQuery is fine for spicing up a blog or something with really basic JavaScript functionality (e.g. a carousel, basic 'contact' form with validation/AJAX).

Anything more 'rich' gets confusing very, very quickly and with how accessible Vue/React/Angular are it doesn't make sense to use jQuery.