HTML onselect Event Attribute
ตัวอย่าง
เรียกใช้ JavaScript หลังจากเลือกข้อความบางส่วนในองค์ประกอบ <input>:
<input type="text" onselect="myFunction()" value="Hello world!">
ความหมายและการใช้งาน
แอตทริบิวต์ onselect เริ่มทำงานหลังจากเลือกข้อความบางส่วนในองค์ประกอบ
รองรับเบราว์เซอร์
Event Attribute | |||||
---|---|---|---|---|---|
onselect | Yes | Yes | Yes | Yes | Yes |
ไวยากรณ์
<element onselect="script">
ค่าแอตทริบิวต์
Value | Description |
---|---|
script | The script to be run on onselect |
รายละเอียดทางเทคนิค
แท็ก HTML ที่รองรับ: | <input type="file">, <input type="password">, <input type="text"> และ <textarea> |
---|
หน้าที่เกี่ยวข้อง
การอ้างอิง HTML DOM: onselect event
❮ คุณสมบัติเหตุการณ์ HTML