Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get javascript control from JQuery object?

I'm a beginner in JQuery,

How can I get the control as a javascript object from a JQuery object

var _object = $(this). ??
like image 380
Homam Avatar asked Mar 22 '11 08:03

Homam


People also ask

Is it possible to access the underlying DOM element using jQuery?

The Document Object Model (DOM) elements are something like a DIV, HTML, BODY element on the HTML page. A jQuery Selector is used to select one or more HTML elements using jQuery. Mostly we use Selectors for accessing the DOM elements.

Which methods return the element as a jQuery object?

The jQuery selector finds particular DOM element(s) and wraps them with jQuery object. For example, document. getElementById() in the JavaScript will return DOM object whereas $('#id') will return jQuery object.

How do I select a specific DOM node in jQuery?

If you have a variable containing a DOM element, and want to select elements related to that DOM element, simply wrap it in a jQuery object. var myDomElement = document. getElementById( "foo" ); // A plain DOM element. $( myDomElement ).

What is a DOM object jQuery?

The Document Object Model (DOM for short) is a representation of an HTML document. It may contain any number of DOM elements. At a high level, a DOM element can be thought of as a "piece" of a web page. It may contain text and/or other DOM elements.


1 Answers

Most common var _object = $(this)[0];

If you have more than 1 elements matched: $(this)[0], $(this)[1], $(this)[2] and so on.

$(this).get() is also possible. It's only advantage over the array model is that it allows selection of the kind $(this).get(-1) where it gets you the last matched object

like image 125
Z. Zlatev Avatar answered Sep 21 '22 21:09

Z. Zlatev