jQuery bind() နည်းလမ်း
ဥပမာ
ကလစ်ဖြစ်ရပ်ကို <p> ဒြပ်စင်သို့ ပူးတွဲပါ-
$("p").bind("click", function(){
alert("The paragraph was clicked.");
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
bind() နည်းလမ်းကို ဗားရှင်း 3.0 တွင် ရပ်တန့်ထားသည်။ ၎င်း အစား on() method ကိုသုံးပါ။
bind() နည်းလမ်းသည် ရွေးချယ်ထားသော ဒြပ်စင်များအတွက် တစ်ခု သို့မဟုတ် တစ်ခုထက်ပိုသော event handlers ကို ပူးတွဲပြီး event ဖြစ်ပေါ်လာသည့်အခါ လုပ်ဆောင်ရန် function တစ်ခုကို သတ်မှတ်ပေးပါသည်။
အထားအသို
$(selector).bind(event,data,function,map)
Parameter | Description |
---|---|
event | Required. Specifies one or more events to attach to the elements. Multiple event values are separated by space. Must be a valid event. |
data | Optional. Specifies additional data to pass along to the function |
function | Required. Specifies the function to run when the event occurs |
map | Specifies an event map ({event:function, event:function, ...}) containing one or more events to attach to the elements, and functions to run when the event occurs |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
များစွာကို ပူးတွဲပါ အကြောင်းအရာတစ်ခုသို့ ဖြစ်ရပ်များစွာကို တွဲနည်း။
တစ်ခုကို အသုံးပြုနည်း အဖြစ်အပျက်များ/လုပ်ဆောင်ချက်များစွာကို ရွေးချယ်ထားသည့်အရာများသို့ တွဲချိတ်ရန်။
စိတ်ကြိုက်အမည်ပေးထားသည့် ဖြစ်ရပ်ကိုင်တွယ်သူထံ ဒေတာတစ်လျှောက် ဖြတ်သန်းနည်း။