4 ms·
>> "Any sane person will tell you to just use jQuery -- plain javascript requires a lot of boiler-plate non-business-logic code to replicate the above example"
by axod 16y ago
>> "Any sane person will tell you to just use jQuery -- plain javascript requires a lot of boiler-plate non-business-logic code to replicate the above example"
BS. Also I'd suggest a book is far better than anything like w3schools. There's a ton of good js books which go through examples and tutorials. "Javascript the definitive guide" is extremely good.
First step though is to get used to the js console within browsers, and play around. For example, load up google, open the js console, and start messing...
document.body.style.background="green";
etc
- Twisol 16y agoIn my opinion the browser console is better for debugging than for learning. You have to know the basics of Javascript to be able to begin "messing" anyways, so it's not really the right "first step". A w3schools-style editable example would be a lot better, especially because you can integrate explanations and guidance into the page.
- tkahn6 16y agoWhat exactly are you calling BS on?
- axod 16y agoThe line I quoted. Maybe I'm just insane. But adding a pointless layer of abstraction to manipulating the DOM is.... pointless.
- tkahn6 16y agoThe second part of that line was referring to javascript in general as compared to other languages. And I think you are insane :) I've never met a single developer (besides you apparently) who prefers the tedium of raw javascript DOM manipulation to jQuery's abstracted methodology. I'll take var i = $('.someclass:first').next().val() over the equivalent raw javascript any day of the week.
- axod 16y agoThere's a lot of us about ;) That syntax you quote is not something I like, and isn't something that will run fast on browsers either. $('<code>') is quite ugly. Any typos inside that string won't be caught. Also I don't find chaining to improve code readability. Dealing with the DOM directly means you can optimize properly. For example, say you want to get an input elements value, in js you'd do: theInputElement.value Since you probably created or referenced the input element from js earlier and saved a ref to it...
- tkahn6 16y agoIf it works for you, more power to you. :)
- thaumaturgy 16y ago> I've never met a single developer (besides you apparently)... Well, now you have. We're just not as noisy as the jQuery guys. :-)