Re:Vue.js is easier to learn than jQuery
by kisstheblade on Sunday October 30, 2016 @08:35AM
(#12829442)
Well if they come from a web design background they know the css selectors which work with jquery.
Unlike your example, which doesn't work as written.
[ Parent
| on HN ]
Probably doesn't work because document.getElementById doesn't work with a CSS #id selector as a parameter, it needs the bare id, so it isn't finding the increment or output elements.
Re:Vue.js is easier to learn than jQuery
by LukasSkywalker on Sunday October 30, 2016 @09:17AM
(#12829616)
You can always use document.querySelector() to target elements using a css selector
Re:Vue.js is easier to learn than jQuery
by the_duke on Sunday October 30, 2016 @02:30PM
(#12831405)
Whoops yeah, I just pasted from their jQuery code and forgot to remove the #. Remove them and it works: https://jsfiddle.net/wqxxufkv/
But as Skywalker mentioned, node.querySelector() / querySelectorAll has been working well across browsers for a while and supports most expressions jQuery selectors would.