This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Is it a good idea to learn JavaScript before learning jQuery?
I want to learn html5 in order to write some games. I realized people include some JQuery code inside the game. So I head over and check JQuery and found that JQuery have some relationship with Javascript.
Should I learn Javascript before learning JQuery?
from http://jquery.com/
jQuery is a new kind of JavaScript Library.
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.
So in order to use jQuery you should know JavaScript as well.
jQuery is a library for the Javascript language. Yes, you have to learn it in order to use jQuery.
JQuery is a JavaScript library, so you should definitely lear JS before JQuery. It's like trying to learn Boost without C++.
JQuery is a Javascript libary. JQuery is built on Javascript. My Javascript skills aren't high but I also use JQuery. If you learn JQuery you will learn at the same time Javascript.
jQuery is a Javascript library in itself, so I do recommend that you study up on Javascript before jumping into jQuery. Although what jQuery is able to achieve in one line of code is far from what Javascript can achieve in even 10 lines of code, it's important to learn that foundation of something before you learn the actual structure built upon it.
Yes, jQuery is just a framework/library of javascript. You should learn javascript before leaning jQuery. When you master javascript, jQuery won't cost you one day to learn.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
What is the main difference between JavaScript and jQuery. I know the minor difference like jQuery is high performance more reliable.
jQuery is a JavaScript library.
Read
wiki-jQuery, github, jQuery vs. javascript?
Source
What is JQuery?
Before JQuery, developers would create their own small frameworks
(the group of code) this would allow all the developers to work around all
the bugs and give them more time to work on features, so the
JavaScript frameworks were born. Then came the collaboration stage,
groups of developers instead of writing their own code would give it
away for free and creating JavaScript code sets that everyone could
use. That is what JQuery is, a library of JavaScript code. The best
way to explain JQuery and its mission is well stated on the front page
of the JQuery website which says:
JQuery is a fast and concise JavaScript Library that simplifies HTML
document traversing, event handling, animating, and Ajax interactions
for rapid web development.
As you can see all JQuery is JavaScript. There is more than one
type of JavaScript set of code sets like MooTools it is just that
JQuery is the most popular.
JavaScript vs JQuery
Which is the best JavaScript or JQuery is a contentious discussion,
really the answer is neither is best. They both have their roles I
have worked on online applications where JQuery was not the right tool
and what the application needed was straight JavaScript development.
But for most websites JQuery is all that is needed. What a web
developer needs to do is make an informed decision on what tools are
best for their client. Someone first coming into web development does
need some exposure to both technologies just using JQuery all the time
does not teach the nuances of JavaScript and how it affects the DOM.
Using JavaScript all the time slows projects down and because of the
JQuery library has ironed most of the issues that JavaScript will
have between each web browser it makes the deployment safe as it is
sure to work across all platforms.
JavaScript is a language. jQuery is a library built with JavaScript to help JavaScript programmers who are doing common web tasks.
See here.
jQuery is a JavaScript library, that can be used for communicating (selecting html elements, attaching event listeners, animations etc.) with the DOM, creating and consuming AJAX requests, as well as other things in a more easier way rather than using plain JavaScript. jQuery is written in JavaScript. It should be mentioned that browsers parse only HTML, CSS and JavaScript files. Hence, all JavaScript libraries/frameworks (jQuery, Knockout, Angular) are written in JavaScript or in languages like TypeScript that transconpiles to JavaScript (e.g. Angular 2). They provide you the opportunity to write less lines of code or to create interfaces following patterns like MVC (e.g. Angular), MVVM (e.g. Knockout) as well as other patterns, but under the hood, they are all result in a JavaScript file.
An example in order to understand why using jQuery you write less do more is the following.
Let we have the following input element
<input id="button1" type="button" value="clickMe"/>
Also, let that we want when someone clicks on the button to be notified through an alert box showing to the user a 'Hello' message.
If we had to do this using plain JavaScript, we would have written the following:
document.getElementById("button1")
.addEventListener('click', function(){
alert("Hello");
});
On the other hand, if we were using jQuery, we would had achieved the same result by just writing this:
$('#button1').click(function(){
alert("Hello");
});
Using jQuery makes things more clear than using plain JavaScript for the same purpose. (write less do more is jQuery's moto)
Furthermore, jQuery handles pretty well the theme of browser compatibility, you can use their API pretty easily without wondering too much as if you should do in case of using plain JavaScript.
Below I have added snippets for the code above:
document.getElementById("button1")
.addEventListener('click', function(){
alert("Hello");
});
<input id="button1" type="button" value="clickMe"/>
$('#button1').click(function(){ alert("Hello"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="button1" type="button" value="clickMe"/>
Javascript is a programming language whereas jQuery is a library to help make writing in javascript easier. It's particularly useful for simply traversing the DOM in an HTML page.
Javascript is base of jQuery.
jQuery is a wrapper of JavaScript, with much pre-written functionality and DOM traversing.
jQuery was written using JavaScript, and is a library to be used by JavaScript. You cannot learn jQuery without learning JavaScript.
Likely, you'll want to learn and use both of them.
go through following breif diffrence
http://www.slideshare.net/umarali1981/difference-between-java-script-and-jquery
jQuery is a multi-browser (cf. cross-browser) JavaScript library designed to simplify the client-side scripting of HTML.
see http://en.wikipedia.org/wiki/JQuery
If the answer is yes, then that's that, but if the answer is no, what enables it to have extra functionality over what can be done in vanilla JS?
Edit: At the time I was unaware that $ was a valid variable name.
Yes. JQuery is basically a library written in javascript, which aims to improve Developer experience.
I'd like to ask a simple question,
Should I use javascript or jquery?
For all I know, jquery is difficult for me to learn (the ajax part at least) and I already know javascript and how to do almost everything in javascript. In some functions I have to say that in my website I used jquery mostly because of the fancy animations but only for that. That is as far as I can go with jquery. So will jquery offer me more in performance or not? Should I learn jquery to create the ajax functions or just stick with javascript?
Also I know it wouldn't be ideal but do you believe that using both jquery and javascript (of course for different functions) will be buggy??
Thanks in advance.
EDIT: Of course I know that jQuery is a Javascript framework I'm asking if it will offer something more in performance thanks.
jQuery is Javascript.
It's just a set of Javascript functions that many people find very convenient.
jQuery.ajax in particular is much easier to use than the native XMLHTTPRequest.
There is nothing wrong with calling functions that aren't defined by jQuery.
jQuery is JavaScript. It's only a framework. So you are totally safe to use both.
Answering your updated question on how jQuery frameworks offer you more than dealing with plain JavaScript:
Write less code and do more
Cross-browser compatibility out-of-the box
A lot of really good plugins available
You should not worry about performance. jQuery gives you so much more.
jQuery is a JavaScript library, so in order to use jQuery you have to be using JavaScript.
That being said, you're free to use both. Use plain JavaScript where you want, use the jQuery library for code which is more clearly expressed in jQuery.
jQuery IS Javascript actually.
But for question, just use both, because jQuery is faster for some stuff, but it is limited. It is only Javascript library.
jQuery is javascript.
That said, if you already are using jQuery in your website, I'd recommend making use of its ajax support. It really is much nicer than attempting to write your own cross-browser implementation.
A question for you - you say you know javascript very well, so have you created a javascript plug-in? ie. a set of reusable functions that you use throughout your site?
jQuery is just this - nothing more. It is a wrapper around javascript that saves a lot of time and code in certain situations.
jQuery does not offer anything over Javascript in terms of performance. It's purpose is to make development easier, better and more productive.
You can do the same functions that jQuery does with Javascript, because jQuery is made with Javascript code.
jQuery tries to simplify a lot the visual and selection tasks that are more tedious with JS.
Use jQuery and, when you need to be more specific, add JS.
As others have noted jquery is javascript..
absolutely jquery, in my opinion, animation is not most amazing part. With jquery you can handle the cross-browser javascript code very easily, and i think the ajax part is so much easier and flexible than the pure javascript xmlhttprequest.
Yes, I would definitely go for jQuery. At start it seems to be a bit difficult, but you'll soon find out that jQuery is way easier to use and better in performance.
After all Javascript takes like 20 lines to make an Ajax call. jQuery would just do (for example):
$.ajax({
type: "POST",
url: "yourscript.php",
data: ({ id : retrieved_id,
firstname : firstname }),
success: function(data) {
$('#txt_id').html(data);
}
});
jQuery will ease up a lot of things for you. I used to be familiar with Javascript too and I was a bit hesitant to start using jQuery, but now I cannot live without it anymore!
Keep in mind though that jQuery IS just like a Javascript library. So you will still be using Javascript.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Is it a good idea to learn JavaScript before learning jQuery?
I am about to start learning JavaScript. However one friend suggested me to go in for jQuery instead since he says future is jQuery. I heard that jQuery is created from JavaScript.
In short, give me one simple reason why developers like me should invest in JavaScript. What is its future?
Part of being a good programmer is having an interest in understanding how things work. You can't understand how JQuery works without knowing JavaScript.
A good programmer has a diversity of skills. Knowing both the JQuery way to do things and the JavaScript-only way makes you more versatile.
Most employers who are looking for someone who knows JQuery are probably also looking for someone who knows ordinary JavaScript.
You can never achieve true expertise in JQuery without understanding JavaScript.
Sometimes even a fairly lightweight framework is more than you need.
If you don't ever learn to do things the hard way, you won't appreciate what's so great about doing it the easy way.
Moreover, if you start by learning to do things the easier way, you'll have that much harder a time motivating yourself to learn to do it the hard way.
Learning the language first without the fancy frameworks builds character.
Who knows, maybe you'll want to make your own framework someday. Or even work on a new version of JQuery. To do that, you'll need to know the language.
jQuery is JavaScript and yes, it makes things a lot easier for you and you can use it without much JavaScript knowledge, and yes, it will probably become even more popular in the future.
BUT: Wherever is jQuery, there will be JavaScript. jQuery is "just" a tool. You still need "plain" JavaScript to solve some problems, e.g. string manipulation.
Imho: You cannot master jQuery if you don't master JavaScript.
And there will be situations where jQuery might be not the best solution, e.g. when you really need high performance.
For me, this is similar to other questions I read here on SO about web frameworks and programming languages, like: Do I have to learn/know PHP if I want to use [Zend | symfony | CodeIgniter].
Seriously: If you don't understand the basics, you cannot use a tool efficiently.
JQuery is a library, written in Javascript, the language. It is almost always the case that learning the library without learning the language is impractical if not impossible, irrespective of the library and the language in question.
jQuery will come and go.
You are a web developer, right? Javascript is huge. Think how much time people spend using a web browser. The entire time they are interfacing directly with html dom, css, and javascript. Or, less and less, flash and "actionscript" (which is basically javascript).
Learn javascript, learn css, learn the dom. Refer to ecma-262 versions 3 and 5 and publications by w3c and whatwg. Read mozdev, cross-check msdn.
After that, take a look at jQuery if you want. You will probably find that you don't need it for 99% of the stuff people use it for.
Every browser has its own implementation of Javascript ( the language ) and the DOM ( library for manipulating elements on the page ). Because of the inconsistency of each browsers Javascript + DOM with another, jQuery ( created with Javascript ) was created as a wrapper that internally deals with these inconsistencies so you can use the easy API.
Underneath the hood, most of your problems are already solved for you so you don't have to think about issues like:
invoking functionality for the DOM ready event
a consistent way of attaching event handlers for click, mouseover and other events, attaching multiple functions to the same action
returning the proper values for elements as well as viewport ( window ).
Because jQuery is a Javascript library you won't master it without mastering Javascript. See my previous answer for recommendations for learning Javascript.
You do not need to know JavaScript in order to use jQuery.
This depends what you want of course.
If you want to put together web pages and don't consider yourself the 'programming type' or you simply don't like JavaScript, then don't bother, spend your time where it will matter most.
Your also asking this question on a site where majority of users are developers so your going to get a lot of people who say you should learn JavaScript, I say learn it if it interests you.
There are pleanty of jQuery solutions out there and support so that you don't need JavaScript.
jQuery IS JavaScript. When you are writing jQuery, you are writing in javaScript. All a library like jQuery consists of is a premade collection of functions you can use in your JavaScript programs.
So, you have to know JavaScript syntax and the core language in order to use jQuery at all. A good book for that is Douglas Crockfords the Good Parts.
What you do not need to know as much about is the DOM API, since that is mainly what jQuery smooths over for you. It helps a lot to understand the concepts of the DOM, though. You still need to know what an element is, and what attributes are.
You also need to know about CSS in order to use jQuery effectively. The key concepts here are classes, IDs, positioning, visiblity and display, among others.
Yes you CAN use jQuery without knowing JavaScript. In fact, I knew very little about JavaScript originally but by using jQuery it sparked my interest to learn it and so I did. Years later I can say I am very proficient with both.
As you progress in your programmer expertise you would find that you go from library writer to library user. This is quite natural and OK. When you are starting off, all you have is the basics. You write your code in terms of those basics and over time find that you need to bunch common code in a library for easier reuse.
Sometime later you find that someone has already done just that and created a library that's even better than yours. You then switch from being library writer to library user. jQuery is one such library and you really need to know JavaScript to be able to draw a line in your head as to where jQuery is and where JavaScript is.
My advice, in light of the above, would be to learn the underlying technology before getting started with the library (which is what jQuery is). However in this case I would make an exception - skip DOM manipulation. DOM is a stupid abstraction and will have you tear your hair out in no time flat. jQuery wraps it up quite nicely, might as well get stuck into that after you understand JavaScript basics.
you can read this
edit
However one friend suggested me to go
in for jQuery instead since he says
future is jQuery.
If you go for jQuery, of course you are still learning Javascript...
You can not understand jQuery if you can not understand how Javascript works.
Some programmers learning jQuery wihtout the knowledge of javascript thought that they are learning a new programming scripting language. But they did not know that jQuery is not. They are just using jQuery as a tool. They are still coding Javascript...
If you want your Javascript codes to be cross-browser,
with less hassle, go for jQuery... but still you need the basic (or at least) knowledge of Javascript.
This question already has answers here:
Closed 13 years ago.
Duplicate:
What are some of the pros and cons of using jQuery?
Should I avoid using a JavaScript library while learning how to write AJAX client code?
I've read it so many times... "I'd learn JavaScript before learning something like jQuery" - but is this really necessary for every situation? Sure, some people like to know what's going on under the hood, but are there any serious negative side effect of heading straight for jQuery tutorials/books? I want to learn something in my spare time and I've decided on jQuery (or JavaScript if anyone can convince me strongly enough).
jQuery is a library, not a language. You've essentially said, "I am thinking of learning how to write English songs. Some people say that you should learn English first, but I'm not convinced that it's worthwhile, I just want to rock."
You can probably still pick up jQuery without learning JavaScript first, but you ultimately will understand nothing of how jQuery is actually working and likely just come to accept that it's magic. Good luck when jQuery breaks or doesn't work how you expected it and can't figure out why your code is broken.
JavaScript is a beautiful language, and worth learning in its own right. Start here: Eloquent Javascript.
The reason of the typical recommendation "learn JS before jQuery" is because you'll find yourself too many times asking yourself how some jQuery snippet works, when it's not a problem of jQuery but JS syntax / etc (e.g. closures).
Go for JS, you won't be disappointed.
That's like asking if it's worth learning learning Objective-C before using Cocoa. It's kind of a weird question, because Cocoa is in Objective-C, much the same way as jQuery is written in JavaScript. When you learn jQuery, you learn some JavaScript whether you like it or not.
I think what you're wondering is more along the lines of "should I learn the underlying JavaScript that jQuery bypasses with its core library and plugins?" It depends on the circumstance, of course; if you need code in a hurry, you're much better off learning jQuery alone. But since your goal seems to be to learn something in your spare time, I personally think it's a good idea to learn basic JavaScript before diving into jQuery:
If you ever need to figure out how the internals of jQuery works, you'll need to know core JavaScript. This is especially important given how many jQuery plugins are out there.
If you ever need to extend jQuery or plugin functionality, you may have to know more detailed JavaScript.
If all you know is jQuery, you'll find it harder to work with other frameworks and/or vanilla JavaScript if you ever find yourself in that situation.
There is no question about it. jQuery is JavaScript. You'll be handicapping yourself severely if you jump straight into jQuery. Your code will be slow and unmaintainable. jQuery is an API, it's not a language.
In fact, you could try jumping into jQuery but I doubt you'll get very far without being frustrated with hurdles that would be otherwise trivial. At the very least, you should understand the concepts in Re-introduction to JavaScript.
It's very good advice actually.
The problem is this. Javascript doesn't work the same way most of the other popular languages work. If you dive into Javascript with the idea that it is similar to Java, C#, Perl, PHP, etc, then you'll end up thinking Javascript is a bizarre, inconsistent mutant language that makes no effing sense whatsoever. This isn't because Javascript makes no sense, it's because Javascript is different at its foundations. Javascript is an object oriented language, but it isn't class based, it's prototype based. The syntax is similar enough to where you could work just fine thinking Javascript was class based up until the point where everything goes horribly wrong.
Learn Javascript first, at least the fundamentals. It's not that difficult, you don't even need a special IDE or compiler since you can just use a browser or WSH. Learning the fundamentals of Javascript will definitely pay off if you're using jQuery.
A lot of learning and using jQuery comes for free to begin with and can be motivating as it provides an immediate sense of productivity. There does come a point however, where you need to understand JavaScript in order to use jQuery effectively or any other JavaScript framework for that matter. This is particularly pertinent for example, when writing plugins and utility functions.
For the same reason VB6 programmers needed to understand the Windows API to get anything done, and VB.NET and C# programmers need to at least know what MSIL looks like, you should be familiar enough with JavaScript to understand what jQuery is doing. There's a lot of far-out stuff built into JavaScript that most people never need to use, but if you don't know it exists, you'll always overlook good solutions to your problems.
JQUERY is just a library, not a substitue for language like JAVASCRIPT. You wont be going ahead in the field of the softare developement by just learning the LIBRARY. Basic understanding of the core langauge is always the better way to go. And of course, once you have that grasp, then you can and should definitley use libary like JQUERY.
I feel rather strongly that JavaScript is a more important concept than jQuery or any of it's siblings. These libraries are wonderful, and I can hardly imagine doing anything in the client without their help, but by themselves they only provide some tools and a bit of flashy polish. To actually accomplish any real logic, you will need a good understanding of JavaScript and the objects that are available in the browser.
Short answer to your question is yes if you ever have written anything in any normal language.
If you want to know why, watch JavaScript the good parts by Douglas Crockford (JS guru).