本文介绍了setAttribute使属性名称为小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 var l = document.createElement(label);
创建元素,并使用 l.setAttribute(分配其属性formControlName, E);
。
问题是setAttribute方法将formControlName放在小写字母中,如下图所示。我使用离子,所以需要大写字母。有谁看到我做错了什么?
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?
推荐答案
请改用:
l.setAttributeNS(null, "formControlName","e");
'setAttributeNS()'不会将名称转换为小写。
'setAttributeNS()' doesn't convert the name to lower case.
这篇关于setAttribute使属性名称为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!