HTML DOM Element removeAttribute() စက်မှု

定义和用法

removeAttribute() 方法从元素中删除属性。

提示:删除不存在的属性或没有设置但有默认值属性的操作将被忽略。

removeAttribute() 和 removeAttributeNode() 的区别

removeAttribute() 方法删除属性,并且没有返回值。

removeAttributeNode() 方法删除 Attr 对象,并返回移除的对象。

အကျိုးဆက်အကျိုးသား များ အတူ အတူသာ ဖြစ်လာပါမည်

ကျမ်းကို ကြည့်ရန်

ပြင်ဆင်ချက်ချုပ်

getAttribute() ဘရာဇီးနယ်

setAttribute() ဘရာဇီးနယ်

hasAttribute() ဘရာဇီးနယ်

hasAttributes() ဘရာဇီးနယ်

getAttributeNode() ဘရာဇီးနယ်

setAttributeNode() ဘရာဇီးနယ်

removeAttributeNode() ဘရာဇီးနယ်

ပါးချုပ်

HTML အခြေခံ

အမှတ်

အမှတ် 1

class အချက်အလက် ကို <h1> အချက်အလက်များ မှ ဖယ်ရှားပါ

document.getElementsByTagName("H1")[0].removeAttribute("class");

ကိုယ်တိုင် ကြိုးစားလမ်း

အမှတ် 2

href အချက်အလက် ကို <a> အချက်အလက်များ မှ ဖယ်ရှားပါ

document.getElementById("myAnchor").removeAttribute("href");

ကိုယ်တိုင် ကြိုးစားလမ်း

အဓိပ္ပာယ်

element.removeAttribute(name)

ပါဝင်သည်

ပါဝင်သည် ဖော်ပြ
name လိုအပ်သည်

ပြန်လည်သတ်မှတ်

အမှတ်

ပေါ်ပေါ်လာပါ

အဆိုပါ အချက်အလက် သည် သာမန် သုံးစွဲသူ ဖြစ်ပြီး အချက်အလက် ကို ဖျက်သိမ်းခြင်း မပြုလိုသေးသေးမှာ ဖြစ်ရာ ဘရာဇီးနယ် Exception အမှတ် NO_MODIFICATION_ALLOWED_ERR ပေါ်ပေါ်လာသည်။

ဘရာဇီးနယ် ထောက်ပံ့

element.removeAttribute() ဘရာဇီးနယ် အချိန် 1 (1998) အချက်အလက် ဖြစ်သည်။

အားလုံး ဘရာဇီးနယ် ကို ပြည့်ပြည့်တင်ပြသည့် အကျိုးဆက်အကျိုးသား များ

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
ထောက်ပံ့ 9-11 ထောက်ပံ့ ထောက်ပံ့ ထောက်ပံ့ ထောက်ပံ့