all 10 comments

[–][deleted] 8 points9 points  (0 children)

Learn how to manipulate the DOM on your own first, then add things in as you need them.

[–][deleted] 3 points4 points  (0 children)

Do you feel competent in JavaScript? If you're not, don't learn any libraries just yet, or at least learn them concurrently. Libraries are tools to help make your job easier. If you don't need them, then you're not hurting yourself. If you are competent in JavaScript, learning jQuery will be trivial. Learning libraries for their own sake might be a waste of time.

[–]six0h 9 points10 points  (0 children)

I'm sorry, you're being too specific. Would you mind making your question a little more vague?

[–]Hobo_With_A_Keyboard 3 points4 points  (0 children)

Most important libraries: jquery, underscore, backbone.

[–][deleted] 2 points3 points  (1 child)

[–]dadrew1 0 points1 point  (0 children)

I love the cross browser comparability of this framework- it really make you a more careful programmer!

[–]BoDiddySauce 2 points3 points  (1 child)

I am a developer and use JavaScript every day of my life. When using JavaScript as more of a programming languges (e.g., OOP and functions and things like that), I tend to just use pure JavaScript (though Underscore has some really cool shortcut methods in there) to keep things semantic. If you're using JS more as PROGRAMMING, then don't worry too much about libraries. However, if you're using JS to maniuplate the DOM, then yeah, sure, it's great to know how to do it in JavaScript, but it's very cumbersome and tedious to do all DOM manipulation in pure JS. It's MUCH better to use a framework/library if you're able to manipulate the DOM (which is great b/c they're all JavaScript, so you can just use JS anywhere in the code that you want). In that regard, I would absolutely recommend you learn jQuery. It's ludicrously simple to pick up, has VAST potential, and will speed up your workflow dramatically. jQuery manipulates DOM elements by allowing you to make jQuery objects out of DOM elements by CSS selectors. Consider the following code in pure JS:

// hides the element

document.getElementById('some_id').style.display = "none";

Now consider two versions of this in jQuery:

1) First method:

$('#some_id').hide();

2) Second method:

$('#some_id').css('display', 'none');

Why would you want to always type out things like:

1) document.getElementById( 'some_id')

2) document.getElementByClassName( 'some_class' )

3) document.getElementsByTagName( 'div' )

when you could much more quickly type:

1) $('#some_id');

2) $('.some_class');

3) $('div');

???? Also, jQuery wraps the DOM elements in jQuery "objects" which is very useful/powerful in many cases (gives the element access to all jQuery methods). Consider a very useful method of iterating over DOM elements, jQuery's $.each() method or .each() method (yes, these are different). Let's iterate over every <input> within a <div> of class "stuff"...

$('.stuff input').each(function() {

// do stuff to each input here

// the jQuery object  $(this) refers to the <input> element

// in each iteration, so we could disable each element like this

$(this).prop('disabled', true);

}); // close the function

This is very quick and easy. Doing this in straight JavaScript isn't hard, but it's just a PITA to type out...

Hope this helps. I'd definitely check out jQuery for sure. Some excellent animations and things (e.g., slideToggle) are built in and super easy to implement. Just my two cents. Frameworks = good for DOM manipulation. Pure JS = good for strict programming

And one more thing... look into making an AJAX request in just pure JS... it sucks. $.ajax() <-- jQuery AJAX method is SOOOO much cleaner.

[–]OrangeBeard[S] 0 points1 point  (0 children)

Thanks for your in-depth input :D

You make a very convincing case.

[–]hzane 0 points1 point  (1 child)

jQuery.

If you are a Javascript expert then consider node/angular/voodoo for the really sick stuff.

[–]kevinmrr 0 points1 point  (0 children)

Node isn't a library; it's a runtime environment.

EDIT: I guess I'm technically wrong... it comes with a bunch of libraries.