jQuery DOM Element Method - get() Method

Example

Get the name and value of the first p element:

$("button").click(function(){
  x=$("p").get(0);
  $("div").text(x.nodeName + ": " + x.innerHTML);
);

Try It Yourself

Definition and Usage

The get() method retrieves the DOM element specified by the selector.

Syntax

$(selector).get(index)
Parameter Description
index Optional. Specifies which matching element to retrieve (by index number).