The jquery Get (Index) method allows you to select an actual DOM element and manipulate it directly, rather than through the jquery function, and then directly access the TagName property of the DOM element. $ (this). Get (0) is equivalent to $ (this) [0].
such as the following elements
Copy Code code as follows:
<input id= "Test" type= "text" name= "xxx" value= "xxx" >
$ ("#test") [0].tagname
Get a DIV (note is uppercase)
How jquery Gets the name of an element, such as
Dd
$ ("#aa"). Xxxmethod get "div"
How jquery Gets the name of an element such as
Dd
$ ("#aa"). Xxxmethod get "div"
$ (' #elementId '). Get (0). tagName
$ ("#aa") [0].tagname it's okay.
JQuery get the sign signature
Copy Code code as follows:
$ (' #elementId '). Get (0). tagName
This gets the tag name in uppercase, such as: A, DIV
Background knowledge:
The transformation of jquery objects and Dom objects
Only jquery objects can use the method defined by jquery. Note that there is a difference between a DOM object and a jquery object, and the method is invoked with a DOM object or a jquery object in mind.
Ordinary DOM objects can generally be converted to jquery objects by $ ().
such as: $ (document.getelementbyidx_x ("MSG") is a jquery object, you can use the method of jquery.
Because the jquery object itself is a collection. So if the jquery object is to be converted to a DOM object, one of these items must be removed, which is generally accessible through the index.
such as: $ ("#msg") [0],$ ("div"). EQ (1) [0],$ ("div"). get () [1],$ ("TD") [5] These are DOM objects, you can use the methods in DOM, but you can no longer use the jquery method.
The following are the correct ways to do this:
Copy Code code as follows:
$ ("#msg"). html ();
$ ("#msg") [0].innerhtml;
$ ("#msg"). EQ (0) [0].innerhtml;
$ ("#msg"). Get (0). InnerHTML; -
The above mentioned is the entire content of this article, I hope you can enjoy.