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) |