Creating the checkbox dynamically using JavaScript?

后端 未结 4 748
醉话见心
醉话见心 2020-11-30 06:10

I am trying to create a checkbox dynamically using following HTML/JavaScript. Any ideas why it doesn\'t work?

4条回答
  •  醉酒成梦
    2020-11-30 07:15

    The last line should read

    cbh.appendChild(document.createTextNode(cap));
    

    Appending the text (label?) to the same container as the checkbox, not the checkbox itself

提交回复
热议问题