Changing a checkbox's state programmatically in dashcode

前端 未结 8 1588
长发绾君心
长发绾君心 2021-02-15 01:28

Okay, so I\'m trying to change a checkbox\'s state programmatically in dashcode. I\'ve tried:

var checkbox = document.getElementById(\"checkbox\");

// I have tr         


        
8条回答
  •  隐瞒了意图╮
    2021-02-15 02:20

    cell = row.insertCell(-1);
    sel = document.createElement('input');
    sel.setAttribute("type", "checkbox")
    sel.setAttribute("name", "myCheckBox")
    cell.appendChild(sel);
    cell.getElementsByTagName('input')[0].checked = true;
    

    I create a table, row then cell and create a checkbox within it. I can the grab hold of the first input object and set the checked status to true.

提交回复
热议问题