jQuery [แอตทริบิวต์^=ค่า] Selector
ตัวอย่าง
เลือกองค์ประกอบ <input> ทั้งหมดที่มีแอตทริบิวต์ชื่อที่ขึ้นต้นด้วย "nation":
$("input[name^='nation']")
ความหมายและการใช้งาน
ตัวเลือก [attribute^=value] จะเลือกแต่ละองค์ประกอบที่มีแอตทริบิวต์เฉพาะ โดยมีค่าเริ่มต้นในสตริงเฉพาะ
ไวยากรณ์
$("[attribute^='value']")
Parameter | Description |
---|---|
attribute | Required. Specifies the attribute to find |
value | Required. Specifies the string the value should begin with |