Are there any things JavaScript can do that jQuery can't?

Possible duplicate:
Is jQuery's answer always?

Currently, everyone is talking only about jQuery in my workplace, there are some senior developers who work mainly with JavaScript, and they have their own rights reserved for jQuery. I'm a little confused between jQuery vs JavaScript

What are the programming problems that cannot be solved with jQuery, and you need to go only for JavaScript, and also for the advantages and disadvantages of using jQuery vs JavaScript ?

Refresh . Would it be fair to say that there are no programming problems that can be solved using JavaScript and not solved using the jQuery Framework?

Update 2 . So far, I don’t think that it can be said that what we can do in JavaScript can be done using jQuery, correct me if you incorrectly list the programming problems that can. Do not use jQuery compared to JavaScript?

+4
source share
14 answers

jQuery is a JavaScript library. By definition, you cannot do anything in jQuery that cannot be executed using JavaScript (you could write your own functions to do whatever jQuery does).

Of course, there are many things that you can do more easily using the library / framework, so they exist.

Pros of using a library such as jQuery, mooTools, Dojo, YUI, etc.:

  • Saves your time in writing and debugs convenient features
  • Disable it is necessary to write the boiler code
  • Smoothing differences between browsers

Minuses:

  1. Your users can download a lot of code that they don’t need for your specific application.
  2. You will not have full control over each line of code on your site if you do not want to become an expert in this particular library.
  3. Their mistakes become your mistakes.
+19
source

you need to know that jQuery is just JavaScript ...

jQuery will just let you get out of cross-browser issues and let you do less coding.

+10
source

There are many things you cannot do in jQuery that can execute Javascript.

The problem is that you are comparing apples to oranges.

jQuery is a library , it is not a language .
When using jQuery, you are writing Javascript code. jQuery does not need to do the same as Javascript, because it is on top of Javascript using Javascript.

For example, there is no jQuery function that allows you to concatenate strings.
But not necessarily, since Javascript can already concatenate strings. No jQuery is needed to reimplement this functionality.

Does this mean jQuery can do less than javascript? Mu .

You can, of course, do more in Javascript than you can do in jQuery. You can do something in Javascript, while jQuery provides only a few shortcuts for commonly used functions. What takes a lot of lines of code to do correctly in plain Javascript is summarized in a single function call in jQuery. The secret is that jQuery contains all these simple Javascript lines that someone has already written for you, so you don't need to. This is just a collection of Javascript snippets perfectly packed into objects and functions to make your life easier; this is not a completely different thing.

Any functionality that jQuery or one of the jQuery plugins do not provide a shortcut to, you will have to write in simple Javascript. While you are on it, you can write it as a jQuery plugin to make it reusable.

+8
source

I don't like the addition instruction "jQuery fixes a lot of cross-browser issues." This is somewhat misleading, as, first of all, what jQuery does is eliminating many of the cross browser issues related to the DOM . For me, a big problem in web development is CSS cross-browser issues, as they cannot be simply encoded. With CSS, we pretty much hung up on what we got (and, unfortunately, this is much less than even simple Javascript).

Of course, there are Javascript libraries that actively change styles in the browser, trying to achieve greater consistency, but I find such methods ugly. Filling in cross-browser logic in Javascript functions is a child game compared to even achieving similar page layout results between IE and ... everything else using pure CSS.

Honestly, whenever I write code for a single browser or ... not IE, I usually don't use jQuery. Defining a few simple wrapper functions around document.getElementById/getElementsByTagName/evaluate can often provide almost jQuery brevity with no overhead. In fact, without confusing the cross-browser BS that you need to deal with, hacking helper functions as needed is a painless and almost enjoyable task, especially if you give up any restrictions on expanding Javasciprt / DOM built-in objects.

But if you are really looking for situations where jQuery is completely useless, try writing server-side Javascript. No DOM, no CSS, no IE, just Javascript bliss. Ah Node.js , where you have been all my life.

+4
source

JQuery and Javascript are not two different things.

If you use jquery, you use javascript.

The question that will make more sense is whether to use jQuery in your Javascript or just Javascript yourself.

One of the great things about jQuery is that it doesn't force you to do anything with jQuery; you can use it as another tool in your larger Javascript based application. It goes well with other Javascript libraries.

+3
source

jQuery is a JavaScript library, so by definition, all that can be done in jQuery can be done in JavaScript, and you need to use JavaScript to use jQuery.

+1
source

jQuery is written in JavaScript, so anything you can do in jquery can be done in Javascript too.

But jQuery saves you a lot of time and introduces you “Selectors” that help A LOT.

+1
source

Not a programming problem, but one point that needs to be carefully considered (and evaluated in a specific context):

High performance

With jQuery, you are tempted to use a “lightweight” solution. For example, you can select all the elements of a particular class that are visible with

 $('.class:visible'); 

On large pages, this can take up to a second. A user who runs slower than 100 ms reduces usability.


In general, you have to say: use the API selector wisely. Do not make unnecessary calls. In most cases, this may work pretty well, but there are times when it really takes time.

+1
source

jQuery is a javascript framework (written in javascript). It adds advanced selectors (for easy DOM traversal), event handlers, light animations, and a simplified AJAX request. All the "programming problems" that are solvable in JavaScript are also solvable in jQuery (since jQuery just adds JavaScript functionality).

0
source

I use jQuery for rich ajax and ui interactions. I use simple javascript for everything else.

Keep in mind that when switching to MVC, I use jQuery to interact with ajax and ui and C # for everything else, because I like to manage things, rather than relying on the client box.

Oh, and with jquery, I no longer worry about which browser is used. It just works, which is such a nice change.

0
source

One of the developers of jQuery - or other frameworks - is that it smooths the rough edges of JavaScript. Instead of being in the know about writing code to solve a browser-related problem, you can focus on your task and take advantage of the efforts of the jQuery core team and the community to maintain a framework for solving these problems.

0
source

It may be nit-picking, but you cannot select the value attribute entered below in jQuery ( stolen from this question ). The problem is the regular expression parser that jQuery uses. Read bobince's excellent answer on this issue.

 <input id="a" type="text" value="a'b]<p>" /> 

The CSS selector for the value attribute with escaping will be [value=a\'b\]\<p\>] .

In JavaScript, we need an extra slash for the string. The escaped selector works with the selectors API , but not with jQuery:

 document.querySelector("[value=a\\'b\\]\\<p\\>]"); // works $("[value=a\\'b\\]\\<p\\>]"); // doesn't work 

Here you are, an example of the holy grail that you were looking for.

Nit-picking aside, jQuery is moving pretty fast, and the above problem is solvable by writing a more robust parser (the actual parser, not the regular expression). jQuery 2 has plans for some awesome features I'm looking forward to, such as a reverse selector (rumored).

 div < span.name 

This will select the entire div's that contains the span having the name class. So far, all selectors have been uni-directional (top to bottom), and we had to go through the DOM hierarchy to get a higher element, but constructs like the one above will make the selector mechanism much more powerful.

0
source

jQuery is a library of commonly used functions that make working with DOM elements easier. There are many discrepancies between browsers related to working with HTML elements (selection, styling, manipulation, etc.), which require many if / else methods for the browser.

That jQuery neglects the fact that JavaScript - the language - is really good. And what JavaScript got right was object inheritance.

jQuery is not object oriented. It also does not attempt to extend or edit existing objects at your disposal. In this sense, jQuery cannot be considered a "Framework".

So, if you want to do work related to objects and extensibility, you have to use Jaincript Plain-ol. If you are going to manipulate elements in a document, you will want to use jQuery or another library / framework.

Some Framework provide BOTH. They facilitate dom manipulations, and also provide a classic inheritance model. See Dojo / Mootools.

0
source

I still don't think that maintainability problems, which were a nightmare for many existing developers using JavaScript, were completely resolved by jQuery. You still land with a lot of java script code, over time it can become spaghetti, maybe the developers work for you, rather stick to the devil that they know.

In an enterprise project where the cost of failure is so high that people can die, etc., they can feel more comfortable with what they know and have an established track record.

-1
source

All Articles