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 prop() နည်းလမ်း

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

ဥပမာ

"အရောင်" အမည်ရှိ ပိုင်ဆိုင်မှုကို ပေါင်းထည့်ကာ ဖယ်ရှားပါ-

$("button").click(function(){
  var $x = $("div");
  $x.prop("color", "FF0000");
  $x.append("The color property: " + $x.prop("color"));
  $x.removeProp("color");
});

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

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

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

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

မှတ်ချက်- prop() နည်းလမ်းအား ပိုင်ဆိုင်မှုတန်ဖိုးများ၊ ဥပမာ- DOM ဂုဏ်သတ္တိများ (tagName၊ nodeName၊ defaultChecked ကဲ့သို့) သို့မဟုတ် သင့်စိတ်ကြိုက်ပြုလုပ်ထားသော ဂုဏ်သတ္တိများကို ပြန်လည်ရယူရန် အသုံးပြုသင့်သည်။

အကြံပြုချက်- HTML ရည်ညွှန်းချက်များကို ပြန်လည်ရယူရန်၊ ၎င်း အစား attr() နည်းလမ်းကို အသုံးပြုပါ။

အကြံပြုချက်- ပစ္စည်းတစ်ခုအား ဖယ်ရှားရန် removeProp() နည်းလမ်းကို အသုံးပြုပါ။


အထားအသို

ပစ္စည်းတစ်ခု၏တန်ဖိုးကို ပြန်ပေးပါ-

$(selector).prop(property)

ပိုင်ဆိုင်မှုနှင့် တန်ဖိုးကို သတ်မှတ်ပါ-

$(selector).prop(property,value)

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

$(selector).prop(property,function(index,currentvalue))

များစွာသော ဂုဏ်သတ္တိများနှင့် တန်ဖိုးများကို သတ်မှတ်ပါ-

$(selector).prop({property:value, property:value,...})

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

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


prop() နှင့် attr() အကြား ကွာခြားချက်သည် မတူညီသောတန်ဖိုးများကို ပြန်ပေးနိုင်သည်။ ဤနမူနာသည် checkbox တစ်ခု၏ "checked" status ကိုပြန်ရန်အသုံးပြုသောအခါ မတူညီမှုများကို ပြသသည်။


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