jQuery add() နည်းလမ်း
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ
ဥပမာ
ရှိပြီးသားဒြပ်စင်အုပ်စု (<h1>) သို့ <p> နှင့် <span> ဒြပ်စင်များကို ထည့်ပါ)။
$("h1").add("p").add("span")
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
add() method သည် ရှိပြီးသားဒြပ်စင်အုပ်စုသို့ ဒြပ်စင်များကို ပေါင်းထည့်သည်။
ဤနည်းလမ်းသည် စာရွက်စာတမ်းတစ်ခုလုံးတွင် ဒြပ်စင်များကို ပေါင်းထည့်မည် သို့မဟုတ် ဆက်စပ် ကန့်သတ်ချက်ဘောင်အတွင်း၌သာ ပေါင်းထည့် သည်။
အထားအသို
$(selector).add(element,context)
Parameter | Description |
---|---|
element | Required. Specifies a selector expression, a jQuery object, one or more elements or an HTML snippet to be added to an existing group of elements |
context | Optional. Specifies the point in the document at which the selector expression should begin matching |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ဒြပ်စင်ကို ကိုးကား၍ DOM ဒြပ်စင်ကို အသုံးပြု၍ တည်ဆဲ <p> ဒြပ်စင်အုပ်စုသို့ <span> ဒြပ်စင်တစ်ခုကို ပေါင်းထည့်ပါ။
သည် ရှိပြီးသား <p> ဒြပ်စင်သို့ <span> ဒြပ်စင်ကို ထည့်ရန် HTML အတိုအထွာကို အသုံးပြုခြင်း။
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ