jQuery before() နည်းလမ်း
❮ jQuery HTML/CSS နည်းလမ်းများ
ဥပမာ
<p> ဒြပ်စင်တစ်ခုစီရှေ့မှာ အကြောင်းအရာကို ထည့်ပါ-
$("button").click(function(){
$("p").before("<p>Hello world!</p>");
});
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
before() method သည် ရွေးချယ်ထားသော element များရှေ့တွင် သတ်မှတ်ထားသော အကြောင်းအရာကို ထည့်သွင်းသည်။
အကြံပြုချက်- ရွေးချယ်ထားသော အစိတ်အပိုင်းများပြီးနောက် အကြောင်းအရာကို ထည့်သွင်းရန် after() နည်းလမ်းကို အသုံးပြုပါ။
အထားအသို
$(selector).before(content,function(index))
Parameter | Description |
---|---|
content | Specifies the content to insert (can contain HTML tags)
Possible values:
|
function(index) | Optional. Specifies a function that returns the content to insert
|
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
ဖြင့် အကြောင်းအရာကို before() နည်းလမ်းဖြင့် ဖန်တီးပါ။
အသုံးပြု၍ အကြောင်းအရာကို ထည့်သွင်းရန် ရွေးချယ်ထားသော အစိတ်အပိုင်းများ မတိုင်မီ အကြောင်းအရာကို ထည့်သွင်းရန် လုပ်ဆောင်ချက်ကို အသုံးပြုနည်း။
❮ jQuery HTML/CSS နည်းလမ်းများ