jQuery prependTo() နည်းလမ်း
❮ jQuery HTML/CSS နည်းလမ်းများ
ဥပမာ
<p> ဒြပ်စင်တစ်ခုစီ၏အစတွင် <span> ဒြပ်စင်တစ်ခုကို ထည့်ပါ-
$("button").click(function(){
$("<span>Hello World!</span>").prependTo("p");
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
prependTo() နည်းလမ်းသည် ရွေးချယ်ထားသော ဒြပ်စင်များ၏အစတွင် HTML အစိတ်အပိုင်းများကို ထည့်သွင်းသည်။
အကြံပြုချက်- ရွေးချယ်ထားသော ဒြပ်စင်များ၏အဆုံးတွင် HTML အစိတ်အပိုင်းများကို ထည့်သွင်းရန်၊ appendTo() နည်းလမ်းကို အသုံးပြုပါ။
အထားအသို
$(content).prependTo(selector)
Parameter | Description |
---|---|
content | Required. Specifies the content to insert (must contain HTML tags). Note: If content is an existing element, it will be moved from its current position, and inserted at the beginning of the selected elements. |
selector | Required. Specifies on which elements to prepend the content to |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ဒြပ်စင်တစ်ခုကို ထည့်သွင်းရန် prependTo() နည်းလမ်းကို အသုံးပြုနည်း။
❮ jQuery HTML/CSS နည်းလမ်းများ