代码如下
html--
<ul id="list" class="mui-table-view"></ul>
js--
var parent_tag=document.getElementById('list');
var arr = []
for(var i = 10; i >= 0; i--) {
arr[i] = i;
}
console.log('arr = ' + arr);
var li_ = document.createElement('li');
var a_ = document.createElement('a');
var div1_ = document.createElement('div');
a_.innerHTML = '动态添加折叠版';
//
li_.setAttribute('class', 'mui-table-view-cell mui-collapse');
div1_.setAttribute('class', 'mui-collapse-content mui-input-group');
mui.each(arr, function(index, item) {
var div2_ = document.createElement('div');
var lable_ = document.createElement('label');
var input_ = document.createElement('input');
div2_.setAttribute('class', 'mui-input-row mui-checkbox mui-left ');
lable_.setAttribute('class', 'mui-badge');
lable_.innerHTML = item;
input_.setAttribute('name','ck');
input_.setAttribute('type','checkbox');
div2_.appendChild(lable_);
div2_.appendChild(input_);
div1_.appendChild(div2_);
});
parent_tag.appendChild(a_);
parent_tag.appendChild(div1_);
有谁知道呢??分享下
1 个回复
MinpLemon
a.appendChild(div1)