Here, you can obtain the tag name in uppercase, for example, A, DIV. If you need the tag name, refer to jquery to obtain the name of an element. For example:
Dd
$ ("# Aa"). xxxmethod returns to "p"
How does jquery obtain the name of an element, such
Dd
$ ("# Aa"). xxxmethod to get "p"
[Kunming] Si Xue Chuan Qiong (447031499) 13:35:50
$ ('# Elementid'). get (0). tagName
$ ("# Aa") [0]. tagName.
JQuery obtains the Tag Name
The Code is as follows:
$ ('# Elementid'). get (0). tagName
Here, the tag name is capitalized, for example, A, DIV.
Background:
Conversion between jQuery objects and dom objects
Only jquery objects can use methods defined by jquery. Pay attention to the differences between dom objects and jquery objects. When calling methods, pay attention to dom objects or jquery objects.
Common dom objects can be converted to jquery objects through $.
For example, $ (document. getElementById ("msg") is a jquery object. You can use the jquery method.
Because the jquery object itself is a set. Therefore, if a jquery object is to be converted to a dom object, You must retrieve one of them. Generally, you can retrieve it through indexes.
For example: $ ("# msg") [0], $ ("p "). eq (1) [0], $ ("p "). get () [1], $ ("td") [5] are all dom objects. You can use methods in the dom, but you cannot use Jquery methods.
The following statements are correct:
$ ("# Msg" cmd.html ();
$ ("# Msg") [0]. innerHTML;
$ ("# Msg"). eq (0) [0]. innerHTML;
$ ("# Msg"). get (0). innerHTML;