Miscellaneous jQuery get () method
Examples
Get the name and value of the first <p> element:
$("button").click(function(){
x=$("p").get(0);
$("div").text(x.nodeName + ": " + x.innerHTML);
});
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 编号)。 |