Phillip Senn
Phillip Senn

Reputation: 47645

Which objects have been replaced by jQuery

I'm reading the JavaScript Bible, trying to learn JavaScript like a good jQuery developer. But the problem with reading a JavaScript reference is that I don't know which objects have been replaced by jQuery (example: getElementsByTagName, getUserData) and which ones haven't.

For instance, is there a "getFeature" replacement in jQuery?

I can imagine the .attr() could be used as a replacement for hasAttribute().

I'd like something with two columns, the left-hand column a jQuery property/method, the right be the JavaScript property/method(s) it replaces so that it tells me "don't worry about these parts, they're not the good parts".

Upvotes: 0

Views: 86

Answers (2)

Andy Gaskell
Andy Gaskell

Reputation: 31761

I think a good approach is to understand the syntax of JavaScript and have a basic understanding of how to manipulate the DOM, make ajax calls, etc. It's good to have an idea of what jQuery is doing for you. Getting the basics down will give you a good intuitive sense what you should do in JavaScript (calculations for example) vs jQuery (DOM manipulation for example).

When moving from JavaScript to jQuery, you will really improve your CSS selector skills. If you have strong CSS selector skills jQuery will be a snap.

Upvotes: 1

mattsven
mattsven

Reputation: 23303

You are looking at this the wrong way. Look at it like this: JavaScript first, jQuery second. jQuery doesn't completely redo everything JavaScript has done, just makes it easier to do. It has it's own personality, but kind of "wraps over" some common JS functions, so to say.

For example:

getFeature becomes: http://api.jquery.com/jQuery.support/

getAttribute, setAttribute, and hasAttribute becomes: http://api.jquery.com/attr/

document.getElementById("special") becomes: $("#special") http://api.jquery.com/jQuery/

Upvotes: 4

Related Questions