jQuery Misc get()メソッド
例
最初の<p>要素の名前と値を取得します。
$("button").click(function(){
var x = $("p").get(0);
$("div").text(x.nodeName + ": " + x.innerHTML);
});
定義と使用法
get()メソッドは、セレクターによって指定されたDOM要素を取得します。
構文
$(selector).get(index)
Parameter | Description |
---|---|
index | Optional. Specifies which of the matching elements to get (by index number) |