Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Miscellaneous get() method

jQuery Miscellaneous get() method

jQuery Miscellaneous Methods jQuery Miscellaneous Methods

Example

Get the first

The element's name and value:

$("button").click(function(){

x=$("p").get(0);

$("div").text(x.nodeName + ": " + x.innerHTML);

});

Try it »


Definition and Usage

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


Syntax

$(

selector

).get(

index

)

Parameters Description
index Optional. Specifies which matched element to retrieve (by index number).

jQuery Miscellaneous Methods jQuery Miscellaneous Methods