English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The get() method retrieves the DOM element specified by the selector.
$ (selector).get(index)
Get the name and value of the first segment (index 0):
$ (document).ready(function() { let x = $("p").get(0); $("div").text(x.tagName + " : " + x.innerHTML); });Test See‹/›
Display the tag name of the click element:
$("*", document.body).click(function(event){ event.stopPropagation(); let domElement = $(this).get(0); $("span:first").text("Clicked - " + domElement.nodeName); });Test See‹/›
Parameter | Description |
---|---|
index | (Optional) An integer starting from zero indicating the element to be retrieved |