jQuery slice() နည်းလမ်း
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ
ဥပမာ
အညွှန်းနံပါတ် 2 ဖြင့် <p> ဒြပ်စင်များမှ <p> ဒြပ်စင်များ ရွေးချယ်ခြင်းကို စတင်ပါ။
$("p").slice(2)
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
slice() နည်းလမ်းသည် ၎င်း၏အညွှန်းအပေါ်အခြေခံ၍ အစိတ်အပိုင်းခွဲတစ်ခုကို ရွေးချယ်သည်။
subset သည် ပိုကြီးသော set ၏ အစိတ်အပိုင်းတစ်ခုဖြစ်သည်။
အုပ်စုတစ်ခုရှိ ဒြပ်စင်များ၏ ရွေးချယ်မှုကို ကန့်သတ်ရန်၊ အစနှင့် အဆုံးအမှတ်ဖြင့် ကန့်သတ်ရန် အသုံးပြုသည်- စတင်သည့် ကန့်သတ်ချက်သည် အစုခွဲ ကို ဖန်တီးရန်အတွက် စတင်အညွှန်းတစ်ခု (0 မှ စတင်သည်) နှင့် ရပ် သော ကန့် သတ်ဘောင်သည် စိတ်ကြိုက်ရွေးချယ်နိုင်သော အဆုံးအမှတ်ဖြစ်သည်။
အထားအသို
$(selector).slice(start,stop)
Parameter | Description |
---|---|
start | Required. Specifies where to start the selection of elements. The index numbers start at 0. Note: Using a negative number will select elements from the end of the selected elements, instead of the beginning. |
stop | Optional. Specifies where to end the selection of elements. If omitted, the selection continues until the end of the set. The index numbers start at 0. Note: Using a negative number will select elements from the end of the selected elements, instead of the beginning. |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
စမှတ်နှင့် အဆုံးမှတ်မှ <p> ဒြပ်စင်များကို ရွေးချယ်ရန် ကန့်သတ်ချက်နှစ်ခုလုံးကို
အနှုတ်နံပါတ်ကို အသုံးပြုခြင်း အစမှအစား <p> ဒြပ်စင်များရွေးချယ်ခြင်းကိုစတင်ရန်
<p> ဒြပ်စင်များ၏ရွေးချယ်မှုကို အစမှစတင်ရန် အနုတ်နံပါတ်ဖြင့် စတင်ခြင်းနှင့် ရပ်တန့်ပါ။
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ