طريقة jQuery triggerHandler ()
مثال
تشغيل حدث التحديد لعنصر <input>:
$("button").click(function(){
$("input").triggerHandler("select");
});
التعريف والاستخدام
تقوم طريقة triggerHandler () بتشغيل الحدث المحدد للعنصر المحدد.
تشبه هذه الطريقة طريقة المشغل () ، باستثناء أن المشغل () يؤدي أيضًا إلى تشغيل السلوك الافتراضي لحدث (مثل إرسال النموذج).
بناء الجملة
$(selector).triggerHandler(event,param1,param2,...)
Parameter | Description |
---|---|
event | Required. Specifies the event to trigger for the specified element |
param1,param2,... | Optional. Additional parameters to pass on to the event handler. Additional parameters are especially useful with custom events |
جربها بنفسك - أمثلة
. كيفية تمرير معلمات إضافية إلى معالج حدث مخصص.
يوضح الفرق بين المشغل () و المشغل ().