jQuery methods on original javascript object?
Did jQuery add any sort of new functionali开发者_如何学Goty to internal JS object like the "anchor" object?
I know you can select via $("a")
, but what happens if i already have an object selected?
Edit: I missed the first half with this answer.
For the first question: No, jQuery doesn't do this, it adds functionality to jQuery objects which is different. Prototype takes this route, extending DOM elements/properties (though last I heard, they're reversing this in Prototype 2.0).
For the second: If you have a jQuery object pointing to the anchor just call any method on it, like this:
myObject.css('color', 'red');
If it's a DOM element you have, just wrap it using $()
:
$(myObject).css('color', 'red');
精彩评论