jQuery eq() နည်းလမ်း
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ
ဥပမာ
ဒုတိယ <p> ဒြပ်စင် (အညွှန်းကိန်း 1 ကို ရွေးပါ)။
$("p").eq(1).css("background-color", "yellow");
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
eq() method သည် ရွေးချယ်ထားသော ဒြပ်စင်များ၏ တိကျသော အညွှန်းကိန်းတစ်ခုဖြင့် ဒြပ်စင်ကို ပြန်ပေးသည်။
အညွှန်းကိန်းဂဏန်းများသည် 0 မှစတင်သည်၊ ထို့ကြောင့် ပထမဒြပ်စင်တွင် အညွှန်းကိန်းနံပါတ် 0 (1 မဟုတ်) ရှိပါမည်။
အထားအသို
$(selector).eq(index)
Parameter | Description |
---|---|
index | Required. Specifies the index of the element. Can either be a positive or negative number. Note: Using a negative number will start the index count from the end of the selected elements, instead of the beginning. |
သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ
အသုံးပြု၍ ရွေးချယ်ထားသောဒြပ်စင်များ၏အဆုံးမှဒုတိယ <p> ဒြပ်စင်ကို ပြန်ပို့ရန်။
❮ jQuery ဖြတ်သန်းခြင်းနည်းလမ်းများ