Latest web development tutorials

Miscellaneous jQuery get () method

jQuery Misc Methods jQuery Misc Methods

Examples

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"

Definition and Usage

get () method to obtain specified by the selector DOM elements.


grammar

$(selector).get(index)

参数 描述
index 可选。规定要获取哪个匹配的元素(通过 index 编号)。


jQuery Misc Methods jQuery Misc Methods