Changing a checkbox's state programmatically in dashcode

前端 未结 8 1464
一个人的身影
一个人的身影 2021-02-15 01:22

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:06

    This question is one month old as I write this answer. It was probably already solved, but in any case I would like to add that if you are using Dashcode, the Checkbox part is a div which contains one label and one input, this one being the "real" checkbox.

    If you inspect the html as it is loaded in Safari you will notice that "checkbox" is the type of the element.

    Therefore the proper way to change the state of the checkbox would be, assuming "input" is its id (it could have a default number attached though):

    document.getElementById("input").checked="true";
    

    or whichever method you want to use.

    The main point here is that you were trying to change the state of another div.

    Hope it helps!

提交回复
热议问题