简体   繁体   中英

setAttribute makes the attribute name lowercase

I create elements with the var l = document.createElement("label");and I assign its attributes with l.setAttribute("formControlName","e"); . The problem is that the setAttribute method puts the formControlName in lowercase letters as you can see in the image below. I work with ionic so the capital letters are needed. Does anyone see what I did wrong?

在此处输入图片说明

在此处输入图片说明

Use this instead:

l.setAttributeNS(null, "formControlName","e");

'setAttributeNS()' doesn't convert the name to lower case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM