jQuery and JavaScript - javascript

Is it necessary to learn JavaScript before jQuery?

jQuery is a JavaScript library. To be able to use it, you need to know JavaScript.
It is possible to pick up JS as you learn jQuery, but this is a terrible approach that will leave you confused about what is JavaScript and what is jQuery.

Yes. Unless you understand Javascript's approach to objects, passing functions, the "this" identifier, and other language specific constructs, you won't be able to understand the prototypes for jQuery functions.
I'm teaching myself both at the same time, but it would certainly help to know Javascript basics (at least) before starting with jQuery.

It's a good idea to know the basics of JavaScript, but you don't need in depth knowledge of it to use JQuery. It's like programming with any other framework. It will do a lot for you, and you can fumble through it with only knowing a little bit of the underlying language, but sooner or later, you'll probably run into a situation where having a good grasp of JavaScript will be helpful.

It would definitely help, but would also probably be fairly painful.
If I were you, I would crack on with jquery...
Make liberal use of visualjquery.com, and you've always got stackoverflow to fall back on...
Good luck fella

Given that jQuery is a library of JavaScript code, meant to ease development of JavaScript applications that interact with web browsers/content, I'd say yes. Now, you could learn both at the same time, like many people have learned Ruby in order to learn Rails. But they're kind of inseparable.

It can be useful if you need to debug something, also: Firebug

Related

Do I need to know good javascript in order to use jquery?

I do not know javascript right now but I am planning on learning it. My question is do I need to have a good understanding of javascript in order to use jquery? I already know actionscript and php which are quite similar. Should I study javascript before learning jquery?
It depends on what you need to to with jQuery..
of course it helps but most basic operations can be done just calling functions of the framework itself with selectors like:
$('#elementId').hide()
So quick answer: yes, you should but until you don't need complex control flow over jquery you can do simple things just with basic syntax.
EDIT: of course without knowing how to attach functions to elements, or how to execute functions when document is loaded you can't do anything, so these basic things are essential before any kind of jQuery usage.
Probably not, although it wouldn't hurt. Chances are, if you learn jQuery, you'll also wind up learning Javascript along the way.
jQuery helps you to use the more advanced aspects of Javascript without a deep knowledge of it. However, it would be helpful for you to get a general overview before you dive in to jQuery.

Does it make sense for software developer to use jQuery when learning Javascript?

It's often claimed that learning a lower-level language is a good foundation for any new developer. What about an experienced developer (say a C++ or Java guy) learning Javascript? in the same way should he learn using the raw language so he understands what's going on, and learn JQuery later, or use JQuery from the start as 'part of' Javascript?
I think it's worth spending a bit of time working on JavaScript without jQuery so you can appreciate just what jQuery brings you. But most of what you'll be learning in JavaScript (getElementById etc.) will be replaced by better jQuery functions, so don't spend too long in pure JavaScript.
I guess the important thing to realise is that a lot of what you do in JavaScript is actually just working with the DOM API. The JavaScript language is great, but the DOM API is RUBBISH. jQuery doesn't really abstract the language, just the API. So the distinction isn't between using JavaScript or using jQuery, it's more about using the DOM API vs using jQuery.
It's always good to understand the basics of 'raw' JavaScript. I would recommend learning basic JacvaScript first, then jQuery. It'll make jQuery easier once you know the basics of the language, and there are still quite a few scenarios where it's preferable to do parts of a code in regular JavaScript than the jQuery way.
You could still try to learn about both in parallel, but either way it is still important to understand JavaScript to really understand appreciate jQuery.
I am pretty new to JavaScript myself, and I had a few months to learn raw JavaScript before finding out about jQuery. I agree with GSto that learning raw is good, but don't spend to much time in it before looking at a framework.
Apart from that, I strongly recommend anyone building in Javascript to pick up a copy of Douglas Crockford's JavaScript: The Good Parts. Read it back to back and then keep it close to your computer!
JavaScript differs from C-like languages quite dramatically at some points...
EDIT: Crockford held a great talk at Øredev 2009. They have the whole talk in video on their site.
Learn Javascript first and about DOM, object literals, closures and currying. When you master these things you are ready to use a library.
If you want to be a good web-developer who knows javascript, then do not touch jquery for at least year. It will corrupt you. Seriously, I've seen too many people who claim that they know javascript but are unable to iterate through an array without using jquery.
I think you should learn raw language before jquery or another framework. If you do, cou can learn jQuery basis wery quickly.
I learned JavaScript before I did anything with jQuery and I would recommend the same to any one thinking to learn JavaScript, as this would allow you to move to another library or use raw JavaScript if you found that jQuery wasn't really suited to what you need or if you simply didn't like jQuery.
There may be some cases in which using raw JavaScript is better suited to what you want to do.
It's very important to learn the language itself, and somewhat important to become familiar with the issues faced by things like jQuery in making the programming environment more uniform across different browsers. However, except as exercises for people who have the time, attempting to re-implement the facilities that modern frameworks provide is a pretty bad idea.
A benefit of learning a modern framework is that they generally encourage the exploitation of the native power of Javascript, and avoid trying to make the language look and act like something it isn't. You have to develop a good feeling for what anonymous functions are and how they work, for example, in order to really use Prototype or jQuery or just about any other framework effectively.
Finally, reading the source code of a good modern framework is wonderfully enlightening.
Think of JQuery as being an abstraction that just happens to be built using Javascript.
Most things that you need to do can be done elegantly with JQuery.
To use JQuery effectively it is more important to understand the DOM, Events and CSS.
It helps me to think of JQuery and Javascript as being different paradigms even though we all know that JQuery is written in JS.
I came to Javascript from a C/C++ background and it took me a while to really get to grips with the object model first-class functions, inner functions and closures and prototypes.
JQuery is much clearer, easier to follow, and more powerful once you understand what it is that you are manipulation (i.e. DOM, Events, CSS).
So I'd learn JQuery first and fill in the Javascript gaps as they appear.
Don't forget that document.getElementById is still the fastest way of getting elements. So if you do simple stuff and that's sufficient so why use a library?
Read what Joel Spolsky says about abstractions. What happens when your abstraction layer leaks? Do you know why the problem happened, or what you can do to fix it?
I would start learning the javascript syntax and usage first, but don't focus too much on the different functions, as a lot of them will have better jQuery alternatives.
The answer - both.
If you are working on something professionally and have a deadline... JQuery. Then go home and learn the internals. JQuery is very powerful and there is no need to reinvent the wheel. Sometimes the best code you write... is no code at all.
Now that being said, its always a good idea to understand your code and the "black majic" that happens under the hood. This helps to decide which JQuery method or selector to use for the best job... measure the pros vs cons.
You should do both at the same time. Learn javascript loops, types, prototypes and just forget the DOM methods because jQuery is more elegant for that.
You should learn basic js first, variables, loops, functions, closures, inheritance, and js design patterns. If you're already a programmer, you can skip a lot of stuff. jQuery is not a language. Once you know that, then jquery is a tool, that mostly helps you abstract differences between browsers (and provides another dialect of js). I don't use jquery, I use ext-js (another tool, another dialect), so I would caution strongly against learning jquery as if it were a language.
If you're going to work with the DOM (as admittedly most do, since most Javascript is used for client-side web development), then JQuery will be helpful.
However, don't confuse it with the language Javascript - JQuery is just another library for DOM access, albeit a very ubiquitous and imho great one.
I'd say it's somewhat analogous to asking if it's wrong to use Win32 or some other platform API while learning C++.
jQuery is just one of several libraries out there. What are you going to do if you don't use jQuery or the company you work for doesn't? Using this library does carry some weight, too. Are you going to always use it even if you only needed one minor feature?

Learning Javascript vs. jQuery

I got the Wrox.Beginning.JavaScript.3rd.Edition and wanted to start learning it from scratch, then my boss came along and said that why bother, learn jQuery.
Can I understand jQuery and work with it although I am a newbie and have limited knowledge in ASP.net, vb.net, some C#, and basic HTML?!
jQuery is javascript. I think you're on the right path. Learn javascript well and you'll be able to make better use of jQuery.
So what's your question? JQuery is a framework built on the top of a language JavaScript. To use JQuery confidently, you should get familiar with JavaScript. JQuery contains a bunch of useful patterns and utils that mask the incompatibilities of the browsers. Using a JavaScript framework make sense as it allows you to focus on your problem instead of the problem of the JavaScript implementations of the browsers.
For further details on JavaScript frameworks, see SO question »Which Javascript framework (jQuery vs Dojo vs … )?«. For learning JavaScript, learn the good parts.
if all your manager is asking from you is to show and hide some elements, or fade in and out a couple of images, or request some data via ajax and display it then learning jquery and its api is perhaps all that you need.
but if you (or your manager) are concerned about performance, maintainability, code reuse and generally understanding what the *ell is going on 'back there' then learning the language itself is a safe bet.
I would suggest grabbing a copy of JavaScript: The Definitive Guide, which will give you a general understanding of what it is and how to use it, and much more. While you are at it, I also suggest John Resig's Pro Javascript techniques. This guy really knows his javascript inside-out (works for mozilla, author of jQuery, amongst others).
As for jQuery, you don't really need to buy a book. Just browse through the API and have a look at its source code. Perhaps you won't understand much, but there are some cool stuff going on that will make you think.
It is entirely possible to learn jQuery without learning every bit of javascript first. However, to be productive and and extend the functionality of plugins etc you will need to know javascript.
I would suggest that you do a bit of both. Continue learning Javascript but when you want to implement functionality make use of the jQuery library.
I would say the statement is akin to you reading a C#/VB.Net book and having your boss say "Don't bother, just learn ASP.Net". You really don't get much from the latter without the former.
JQuery provides a good layer of abstraction for interacting with DOM elements. You can do a lot of interesting things with it quickly and easily. But there are probably many things that JQuery won't do for you. You'll need to use regular JavaScript for that.
jQuery removes the need for many bad Javascript habits.
However, you will frequently need to know more than just jQuery to get non-trivial work done.
You'll need to learn both, but try to pick up habits based on jQuery.
jQuery is made from javascript. :)
It would be a very good idea to read the source-code of jQuery to enhance your overall understanding of javascript...
Definitely learn both at the same time :)
Good luck and have fun.
Maybe your boss is trying to save you some time learning the basics of Javascript and start you off learning jQuery right away but I think this would be a bad idea.
Understanding the basics of javascript is key to using jQuery successfully. jQuery provides shortcuts and solutions to problems (cross browser problems etc) but it is not a language unto it's self.
My advice, learn javascript, learn about handling events in different browsers, inserting in to the DOM and then start using jQuery. You will appreciate it a lot more and be a better coder for it.
If you already have an understanding of C#, you'll have a head start learning Javascript and it shouldn't be too hard to pick up. I'd stick with that Javascript book though, since you need to know Javascript to use jQuery. Once you are comfortable with Javascript, move on to learning jQuery. The jQuery docs are VERY helpful and can answer almost any question you have.
Good luck with learning it, it'll be worth it.
jQuery Docs
what are U doing? - ofcourse pure JavaScript is better =)
Libraries will alwas contain nonessential complexity, but they can save some headaches if they're not too bloated or already present on the end users' systems. Best use would be to learn javascript while using jquery, and then slowly remove the crutch of using jquery. While it's powerful, it does add significant overhead, nonessential complexity, and potential opportunities for abuse, just like flash. There are no silver bullets.

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

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
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.
An emphatic YES. It won't take as long to learn as you fear and the rewards will be more than worth it.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
Suppose you should know the following about Javascript:
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).
What is closure and how to create it.
How to create onLoad event in the browsers listed above.
Have an example of the HTML/Javascript code where you have pure HTML code like
Remove
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
I think learning events the document object model, and JavaScript forms programming is enough to get started in jQuery.
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.
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.
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.
Just enough to debug your code. Otherwise, you will never be able to figure out what's not working.
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.
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.

Should I learn/become proficient in Javascript?

I am a .NET webdev using ASP.NET, C# etc... I "learned" javascript in college 5+ years ago and can do basic jobs with it. But I wonder if it is useful to become proficient in it.
Why should I learn Javascript?
Is it more advantageous then learning JQuery or a different library?
Yes, definitely learn Javascript before you learn one of the libraries about. It's the whole walk-before-you-can-run thing.
Make sure you add these sites to your bookmarks:
Mozilla's developer site: This contains the reference to the Javascript API in Mozilla. This will help you make sure you're writing code that Firefox understands.
IE's site in Microsoft Developer Network: The same, for IE.
W3's reference of DOM for HTML: In most web applications today, the Javascript code manipulates the DOM, which is an internal keeping track of the objects displayed on screen (but you already knew that, right ?) This is the reference to the DOM API. It is language neutral, which means it does not target Javascript, but these methods exist in Javascript too.
Douglas Crockford' site: Doug Crockford is THE MAN when it comes down to Javascript. The articles in his page are a must read. Because Javascript has closures and first-class functions, he believes it is closer to Lisp and Scheme than to other languages. And he teaches you how to greatly improve your code with these language features.
Yahoo Developer network: You may also want to check this. I'm not a regular visitor to this site, though, so I can't really say much about it.
Yes, absolutely you should learn JavaScript if you are doing web development. I highly recommend JavaScript: The Good Parts, by Doug Crockford. And, JQuery is a great framework to use (this site uses it) -- it kind of depends on what you are trying to do -- YUI and ExtJS are also very nice.
The answer is simple.
Hands down yes. There's a reason that Google have made such a big fuss about the V8 JS engine for Chrome, why Mozilla are working on TraceMonkey for Firefox and why Webkit have been working on Squirrelfish for a while (now Squirrelfish extreme). It's because JS is becoming more popular by the day.
Javascript is one of those languages that spending a few hours learning will probably teach you 99% of what you will ever really use. I would imagine you are at the point in your learning of javascript that you know more than enough now and just learn one or more of the frameworks now.
I would recommend brushing up on your non-frameworked javascript first. Refreshing/learning basic concepts of dom manipulation and what not. Like learning how to build a linked list, stack or queue in C++ before learning how to use the STL (standard template libraries).
In addition to brushing up on straight javascript, it might be good to get into a framework that doesn't abstract and change the way things work so much, for instance Prototype. You code with it very much the same way you code with straight javascript. Read through the Prototype code, learn how to make classes, and do some fancy stuff. From experience, I can say reading through the Prototype.js helped me learn alot.
After messing around a bit, then I'd say go for jQuery. If jQuery didn't, literally, change the way you write code I'd say go for it first, but learning how to build classes and js inheritance and what not can be a very important lesson for someone who wants to become fluent in JS.
Learning javascript is recommended for any web application developer. Why?
You will better understand the possibilities, limitations and dangers related to developing a web application
It is a boost for your career, if you are working on a web application that has a user interface.
However, learning javascript is usually a trade-off between a programming language and another. You should consider whether javascript is relevant for your career or project.
Unless you want to really get into javascript, I think you'd be better off learning enough JS to leverage one of the tried and tested javascript libraries out there.
One thing nice about JavaScript is that it is quite different from mainstream languages such as C#, VB.NET or Java. Learning it, especially if you have occasions to use it, will give you another insight on programming, and that's always good. I think it's worth learning it.
If you are doing web development then at some point you are going to get exposed to Javascript or ECMAScript at some point in your career for any one of a number of reasons. At a minimum you should know enough Javascript to be able to be able to validate user input; however, the web is moving in the direction of using more an more Ajax so you should also know enough Javascript to properly leverage one of the major libraries out there such as jQuery.
As some of the other users have noted, you can learn most of what you need of Javascript on a day to day basis in a single day or a couple of afternoons. If you want to get more advanced with Javascript then you are going to have to invest much more time in learning the language but odds are that unless you seek out this type of work that you are not going to encounter something that a preexisting library doesn't already exist for.
If all you want is to do some simple UI-effects and the like, I suggest you just pick a library and go for it!
Using libraries eliminates all the flawed implementations of JavaScript and provides you with an API which is the same across all browsers. And if you're working together with others it is also a great way of implementing code-standards and best practices.
Learning a second programming language is always good.
By the sound of it, JavaScript is a language that you use, to it will be of practical use too. As a web dev, it has been recommended to me in a review that i learn at least basic JavaScript.
A library such as jQuery is essential for web development thse days, so you could learn that too.
I don't think a lot of deliberate learning makes sense (but of course you need some basic knowledge), but I also think after some years of web development you'll become pretty proficient in the language anyway :)
If you are a webdev then yes, you should be proficient with Javascript. Javascript is a major part of making web apps as interactive as desktop apps.
With that being said, learn to use one of the cross-browser compatible libraries like JQuery, Prototype, etc. We do not need to have any more single browser crud created using Javascript, just because any real man/woman rolls their own.
A few things to learn in Javascript:
1. Basic syntax
2. The various flavours of function declaration.
3. Passing functions around and how to use passed in functions.
I recommend Jeremy Keith's books: DOM Scripting and Bulletproof Ajax. After you become more fluent in JS I would recommend a JS library(I use jQuery, but that is not important).
JS is important to learn. You cannot use a framework without the proper understanding of how it works. That is doing things backwards.
i thing you should have a good knoloedge base of language specification and DOM (Document Object Model). it means,you shoud know how find/create "page object" an edit properties. Also you should have an idea of "object oriented" javascript tecniques, which the starting point of a lot of framework. you don't need learn specific framework if you don't use it. simple keep in mind generic base concept!
I'll go with the opposite answer most are putting out there. Learning javascript as a developer these days is almost pointless. The language is similar enough to java/C# that it's syntax and semantics shouldn't be lost on you.
What you should learn is jQuery.
As you use jQuery you'll pick up the most common things you'll ever need from javascript anyway.
If you're involved with the Web in anyway then the answer is "Yes, always". Maybe an embedded or system's programmer could get by without JavaScript, but not a webdev.
Most of the libraries are designed to alleviate some of the pain of interacting with a multitude of browsers. They will not abstract away core JavaScript functionality.
Yes, you should learn JavaScript. Sooner or later you will need to use it!

Categories

Resources