jQuery unbind() နည်းလမ်း
ဥပမာ
<p> ဒြပ်စင်အားလုံးအတွက် ပွဲကိုင်တွယ်သူအားလုံးကို ဖယ်ရှားပါ-
$("button").click(function(){
$("p").unbind();
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
unbind() နည်းလမ်းကို ဗားရှင်း 3.0 တွင် ကန့်ကွက်ထားသည်။ ၎င်းအစား off() method ကိုသုံးပါ ။
unbind() နည်းလမ်းသည် ရွေးချယ်ထားသော ဒြပ်စင်များမှ အစီအစဉ်ကိုင်တွယ်သူများကို ဖယ်ရှားသည်။
ဤနည်းလမ်းသည် အဖြစ်အပျက် ဖြစ်ပေါ်လာသောအခါတွင် သတ်မှတ်ထားသော လုပ်ဆောင်ချက်များကို လုပ်ဆောင်ခြင်းမှ ရပ်တန့်နိုင်သည် သို့မဟုတ် ရွေးချယ်ထားသော အဖြစ်အပျက်အားလုံးကို ဖယ်ရှားနိုင်သည်။
ဤနည်းလမ်းသည် ဖြစ်ရပ်အရာဝတ္တုကို အသုံးပြု၍ ဖြစ်ရပ်ကိုင်တွယ်သူများကိုလည်း စည်းနှောင်နိုင်သည်။ ၎င်းသည် ဖြစ်ရပ်တစ်ခုအား သူ့အလိုလိုအတွင်းမှ တွဲထုတ်ရန် အသုံးပြုသည် (အကြိမ်အရေအတွက်အချို့ကို အစပျိုးပြီးနောက် အစီအစဉ်ကိုင်တွယ်သူကို ဖယ်ရှားခြင်းကဲ့သို့)။
မှတ်ချက်- ကန့်သတ်ဘောင်များကို မသတ်မှတ်ထားပါက၊ unbind() နည်းလမ်းသည် သတ်မှတ်ထားသော ဒြပ်စင်မှ ဖြစ်ရပ်ကိုင်တွယ်သူအားလုံးကို ဖယ်ရှားပါမည်။
မှတ်ချက်- unbind() method သည် jQuery နှင့် ပူးတွဲပါရှိသော မည်သည့် event handler တွင်မဆို အလုပ်လုပ်ပါသည်။
အထားအသို
$(selector).unbind(event,function,eventObj)
Parameter | Description |
---|---|
event | Optional. Specifies one or more events to remove from the elements. Multiple event values are separated by space. If this is the only parameter specified, all functions bound to the specified event will be removed. |
function | Optional. Specifies the name of the function to unbind from the specified event for the element |
eventObj | Optional. Specifies the event object to remove to use. The
eventObj parameter comes from the event binding function |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ခြင်းအား မည်ကဲ့သို့ စည်းမည်နည်း unbind() နည်းလမ်းကို အစိတ်အပိုင်းတစ်ခုအတွက် သတ်မှတ်ထားသော ဖြစ်ရပ်တစ်ခုမှ သီးခြားလုပ်ဆောင်ချက်တစ်ခုအား စည်းနှောင်ရန် unbind() နည်းလမ်းကို အသုံးပြုနည်း။
ခြင်းမှ ဖယ်ရှားရန် ဖြစ်ရပ်အရာဝတ္တုကို သတ်မှတ်ပါ။