[英]Twitter bootstrap typeahead unable to add to dynamically created element
[英]Add Bootstrap to a dynamically created element
每当按下按钮时,我都会动态创建一个表单,但我不知道如何为此表单元素添加 Bootstrap。
'''
var f = document.createElement("form");
f.setAttribute('method',"post");
var i = document.createElement("input");
i.setAttribute('type',"text");
i.setAttribute('name',"username");
var s = document.createElement("input");
s.setAttribute('type',"submit");
s.setAttribute('value',"Submit");
f.appendChild(i);
f.appendChild(s);
document.getElementsByTagName('body')[0].appendChild(f);
'''
您可以设置属性 class
s.setAttribute('class',"btn btn-success");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.