Is it a good idea to learn JavaScript before learning jQuery?

JavascriptJquery

Javascript Problem Overview


Is it a good idea to learn JavaScript before learning a JavaScript framework library such as jQuery, Prototype, etc.?

Sometimes I find myself struggling because I feel I don't know JavaScript as well as I should.

Javascript Solutions


Solution 1 - Javascript

An emphatic YES. It won't take as long to learn as you fear and the rewards will be more than worth it.

Solution 2 - Javascript

> Sometimes I find myself struggling > because I feel I don't know Javascript > as well as I should?

I think you answered your own question.

Solution 3 - Javascript

I'll go against the grain and say that, while ideally you would become proficient in JavaScript before learning jQuery, you can probably make great progress on both fronts by jumping in and coding using the library.

One of jQuery's strengths is that it makes it easier to do certain things in the browser. You can get a lot of real work done by cutting and pasting and adapting other people's code, so why not start doing that? As you go, when you encounter an idiom you don't quite understand, dig around and find out what it means or how it works.

Over time, you will become a master of both JavaScript and jQuery.

If you have any kind of programming background, a good book to read to get you up to speed quickly on JavaScript is Douglas Crockford's, JavaScript: The Good Parts.

Solution 4 - Javascript

Long as you learn the BASICS in Javascript; HTML document traversing, event handling, etc... you should have no problem learning jquery.

Then from learning the basics you will understand how Jquery is to help you do the things that javascript can do, but with less work.

Solution 5 - Javascript

The answer to your question is a definitive yes. jQuery, Prototype and the rest serve to overcome cross-browser headaches and ease AJAX, UI behaviours, DOM operations etc. You'll end up with some pretty bad code if you are just copy/pasting snippets or have no real understanding of Javascript.

As a litmus test, you should be able to follow everything that is said in this wonderful re-introduction to Javascript. It's a bare minimum for writing good code and may require some more Googling on your part. Only then should you read Willison's equally good introduction to jQuery.

That should provide you a good start to build upon. And then if you feel up to it, you can start digesting Crockford (start with Douglas Crockford — JavaScript: The Good Parts).

Solution 6 - Javascript

Yes it a good idea because jQuery provides you with shortcuts for some methods and effects. By learning JavaScript you get the complete idea about how jQuery is working. It will help you to solve bugs and issues in future, when you will be working on a project.

Solution 7 - Javascript

Call me old-fashioned, but I think it is best to learn the basics of one tool before moving on to its advanced cousin -- much like being competent with a handsaw before moving on to a circular saw.

If you are struggling, you've answered your own question. I feel you'll be better equipped to make good use of JQuery once you are comfortable with JavaScript.

Solution 8 - Javascript

When I started my switch from VBScript to JavaScript I was immediately enthralled with Jquery. After a short while I started to really understand how JavaScript and Jquery interacted with each other and I became a little confused and frustrated. My issue was with the desire to use the simplicity of Jquery but I felt like I was cheating myself by not learning JavaScript first.

It turned out that I learned both at the same time. As I wrote JQuery routines I found the need to learn JavaScript in order to understand why things worked the way they did and to help make certain Jquery routines work correctly.

I am still learning JavaScript and Jquery but I am much less concerned about becoming a master of JavaScript as I know my understanding will grow as it needs to. It definitely helps to have some basic understanding of JavaScript but I would say you should focus on learning how to accomplish specific tasks and not on learning JavaScript before JQuery...

My $0.02 worth.

Solution 9 - Javascript

To some degree, but don't get hung up on object oriented programming like in the java world (in javascript it's prototyping anyway). It would help in the long run to have a good understanding of closures/anonymous function and how the special variable "this" is used (particularly with regards to events such as click) and how functions like "apply" work. I'd also make sure that you really understood CSS selectors as they are a central feature of jQuery and pretty much every other JS framework out there.

You're also going to need to be familiar with how to use the full functionality of firebug.

I'd also assume you have a basic understanding or knowledge of how the DOM works.

That's the start of tinkering in Javascript.

Solution 10 - Javascript

As I see it, jQuery is nothing but a framework to make your life simpler. jQuery itself is written in javascript. So it helps to learn javascript.

Mind you, you need not be a master but should be able to make the necessary changes /work arounds, when what you can do with jQuery alone is not sufficient.

Solution 11 - Javascript

The value proposition for jQuery (or any other framework) doesn't only come from what it does with javascript. It also builds on the DOM, HTML, and a number of language-agnostic patterns. And you don't need to understand it all in depth to find frameworks useful. Of course, you'll be better off if you know all the pieces, but we all need to start from something less.

I learned jQuery and javascript simultaneously, and it worked quite well for me that way.

I think the question isn't so much which to learn first, but more to the point, you need to expect to become increasingly familiar with all the pieces and how they work together.

To me it's somewhat (not entirely) the same question as what you need to know before starting with WebForms. Sure it's better if you're already comfortable with C# (and the same DOM and html), but it's legitimate to use WebForms as a vehicle for your education. Same thing can be said for frameworks.

Solution 12 - Javascript

Suppose you should know the following about Javascript:

  1. How to calculate the X and Y element offset for the absolute/relative positioned DIV for browsers IE6-IE8, FireFox, Opera, Safari (each of the browser has different model for this particular case).

  2. What is closure and how to create it.

  3. How to create onLoad event in the browsers listed above.

  4. Have an example of the HTML/Javascript code where you have pure HTML code like

<a href="" rel="remove">Remove</a>

and javascript code that add special handlers in automatic mode for A tag using "rel" attribute.

After you get acquainted with this you may use jQuery library that hide the complexity of this :)

Regards, Pavel

Solution 13 - Javascript

I think learning events the document object model, and JavaScript forms programming is enough to get started in jQuery.

Solution 14 - Javascript

Of course, it goes without saying. How can you use jQuery if you don't learn JavaScript first? After all, jQuery is nothing but a library for JavaScript.

Solution 15 - Javascript

Yes.

You obviously don't need to learn everything about JS. But at least learn the basics, and try to learn some best practices.

For me the trickiest part about Javascript is all the different implementations of it in the different browsers. But there are certain things you can do to help yourself avoid some of those problems. For example, it's usually preferred to use document.getElementById() to access elements in the DOM since it essentially works the same way in all modern browsers. Also, it's almost always best to use feature detection rather than browser detection. Little things like that go a long way in avoiding problems in specific browsers later on.

Fortunately JQuery was written pretty well for cross-browser compatibility, but there may be times when you don't want to use it directly and you may have to rely on your JS skills.

Solution 16 - Javascript

There are really two seperate aspects to JavaScript within the Browser. First, the JavaScript Language, and second the HTML DOM that allows you to manipulate the page using the JavaScript Language.

That said, then YES you should spend time learning the JavaScript Language. I recommend picking up a copy of "JavaScript: The Good Parts" by Douglas Crockford.

Now as to the second part, the HTML DOM. You really don't need to focus too much on learning the ins and outs of the HTML DOM if you are going to use a framework like jQuery. Just do things the "jQuery way" and then pick up as much HTML DOM as is necessary along the way.

Solution 17 - Javascript

Just enough to debug your code. Otherwise, you will never be able to figure out what's not working.

Solution 18 - Javascript

Learning JS would make life easier for coding JQuery but I don't see why you should necessarily learn it first. You'll just have to learn it eventually.

Solution 19 - Javascript

My first thought was that It's always good to learn something new and Javascript is becoming ubiquitous (now is on the server side too ).

It's seems that you have still not decided the best answer for you and AFAIK this question was posted before March 21 ... I see plenty of time to read at least this that was written by a very talented guy.

If you study javascript you will never come to SO asking question like:

> What the keyword this mean in the contest of my snippet of code?

But if you always are in a hurry, without having time to improve your code and If you never have to build jQuery plugins go without Javascript.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionXaisoftView Question on Stackoverflow
Solution 1 - JavascriptDinahView Answer on Stackoverflow
Solution 2 - JavascriptJesse WeigertView Answer on Stackoverflow
Solution 3 - JavascriptAndrew HedgesView Answer on Stackoverflow
Solution 4 - JavascriptTStamperView Answer on Stackoverflow
Solution 5 - JavascriptaleembView Answer on Stackoverflow
Solution 6 - JavascriptMayur ShahView Answer on Stackoverflow
Solution 7 - JavascripttgerhardView Answer on Stackoverflow
Solution 8 - JavascriptDscoducView Answer on Stackoverflow
Solution 9 - JavascriptcgpView Answer on Stackoverflow
Solution 10 - JavascriptrAmView Answer on Stackoverflow
Solution 11 - JavascriptdkretzView Answer on Stackoverflow
Solution 12 - Javascriptse_pavelView Answer on Stackoverflow
Solution 13 - JavascriptTreckkerView Answer on Stackoverflow
Solution 14 - JavascripthasenView Answer on Stackoverflow
Solution 15 - JavascriptSteve WorthamView Answer on Stackoverflow
Solution 16 - JavascriptChris PietschmannView Answer on Stackoverflow
Solution 17 - JavascriptTFMView Answer on Stackoverflow
Solution 18 - JavascriptTheAntsAreMyFriendsView Answer on Stackoverflow
Solution 19 - JavascriptmicrospinoView Answer on Stackoverflow