jQuery undelegate()วิธี การ

❮ วิธีการจัดกิจกรรม jQuery

ตัวอย่าง

ลบตัวจัดการเหตุการณ์ทั้งหมดที่เพิ่มด้วยวิธี delegate() ออกจากองค์ประกอบทั้งหมด:

$("body").undelegate();

ความหมายและการใช้งาน

เมธอด undelegate() เลิกใช้แล้วในเวอร์ชัน 3.0 ใช้วิธี off()แทน

เมธอด undelegate() จะลบตัวจัดการเหตุการณ์ตั้งแต่หนึ่งตัวขึ้นไป เพิ่มด้วย เมธอดdelegate()


ไวยากรณ์

$(selector).undelegate(selector,event,function)

Parameter Description
selector Optional. Specifies the selector to remove event handlers from
event Optional. Specifies one or more event types to remove handler functions from
function Optional. Specifies a specific event handler function to remove

ลองด้วยตัวคุณเอง - ตัวอย่าง


วิธีใช้เมธอด undelegate() เพื่อลบตัวจัดการเหตุการณ์การคลิกทั้งหมดสำหรับองค์ประกอบ <p> ทั้งหมด


วิธีใช้งาน undelegate() เพื่อลบเฉพาะฟังก์ชันเฉพาะ


❮ วิธีการจัดกิจกรรม jQuery