jQuery ကျူတိုရီရယ်

jQuery ပင်မစာမျက်နှာ jQuery မိတ်ဆက် jQuery စတင်လိုက်ပါ။ jQuery Syntax jQuery ရွေးချယ်မှုများ jQuery ပွဲများ

jQuery အကျိုးသက်ရောက်မှုများ

jQuery ဖျောက်/ပြပါ။ jQuery အရောင်မှိန်ခြင်း။ jQuery Slide jQuery Animate jQuery stop() jQuery ပြန်ခေါ်ပါ။ jQuery ချိတ်ဆက်ခြင်း။

jQuery HTML

jQuery ကိုရယူပါ။ jQuery သတ်မှတ် jQuery ကိုထည့်ပါ။ jQuery ကိုဖယ်ရှားပါ။ jQuery CSS အတန်းများ jQuery css() jQuery အတိုင်းအတာများ

jQuery လမ်းလျှောက်ခြင်း။

jQuery လမ်းလျှောက်ခြင်း။ jQuery ဘိုးဘေးများ jQuery မျိုးဆက်များ jQuery မောင်နှမများ jQuery စစ်ထုတ်ခြင်း။

jQuery AJAX

jQuery AJAX နိဒါန်း jQuery Load jQuery Get/Post

jQuery ထွေ

jQuery noConflict() jQuery စစ်ထုတ်မှုများ

jQuery ဥပမာများ

jQuery ဥပမာများ jQuery စာမေးပွဲ jQuery လေ့ကျင့်ခန်းများ jQuery လက်မှတ်

jQuery ကိုးကားချက်များ

jQuery ခြုံငုံသုံးသပ်ချက် jQuery ရွေးချယ်မှုများ jQuery ပွဲများ jQuery အကျိုးသက်ရောက်မှုများ jQuery HTML/CSS jQuery လမ်းလျှောက်ခြင်း။ jQuery AJAX jQuery ထွေ jQuery ဂုဏ်သတ္တိများ

jQuery attr() နည်းလမ်း

❮ jQuery HTML/CSS နည်းလမ်းများ

ဥပမာ

ပုံတစ်ခု၏ width attribute ကို သတ်မှတ်ပါ-

$("button").click(function(){
  $("img").attr("width","500");
});

အဓိပ္ပါယ်နှင့် အသုံးပြုမှု

attr() နည်းလမ်းသည် ရွေးချယ်ထားသော ဒြပ်စင်များ၏ အရည်အချင်းများနှင့် တန်ဖိုးများကို သတ်မှတ် သို့မဟုတ် ပြန်ပေးသည်။

ရည်ညွှန်းချက်တန်ဖိုးကို ပြန်ပေးရန် အတွက် ဤနည်းလမ်းကို အသုံးပြုသောအခါ ၊ ၎င်းသည် FIRST ကိုက်ညီသောဒြပ်စင်၏တန်ဖိုးကို ပြန်ပေးသည်။

ရည်ညွှန်းချက်တန်ဖိုးများကို သတ်မှတ်ရန် ဤနည်းလမ်းကို အသုံးပြုသောအခါ ၊ ၎င်းသည် ကိုက်ညီသော ဒြပ်စင်အစုအတွက် တစ်ခု သို့မဟုတ် တစ်ခုထက်ပိုသော အရည်အချင်း/တန်ဖိုးအတွဲများကို သတ်မှတ်ပေးသည်။


အထားအသို

ရည်ညွှန်းချက်တစ်ခု၏တန်ဖိုးကို ပြန်ပေးပါ။

$(selector).attr(attribute)

ရည်ညွှန်းချက်နှင့် တန်ဖိုးကို သတ်မှတ်ပါ-

$(selector).attr(attribute,value)

လုပ်ဆောင်ချက်ကို အသုံးပြု၍ အရည်အချင်းနှင့် တန်ဖိုးကို သတ်မှတ်ပါ-

$(selector).attr(attribute,function(index,currentvalue))

များစွာသော အရည်အချင်းများနှင့် တန်ဖိုးများကို သတ်မှတ်ပါ-

$(selector).attr({attribute:value, attribute:value,...})

Parameter Description
attribute Specifies the name of the attribute
value Specifies the value of the attribute
function(index,currentvalue) Specifies a function that returns the attribute value to set
  • index - Receives the index position of the element in the set
  • currentvalue - Receives the current attribute value of selected elements

သင်ကိုယ်တိုင်စမ်းကြည့်ပါ - ဥပမာများ


ကို element တစ်ခုအတွက် attribute တစ်ခုရဲ့တန်ဖိုးကို ဘယ်လိုပြန်ပေးမလဲ။



များကို သတ်မှတ်ခြင်းသည် element တစ်ခုအတွက် multiple attributes/values ​​များကို သတ်မှတ်နည်း။


❮ jQuery HTML/CSS နည်းလမ်းများ