简体   繁体   中英

How to connect checkbox to box shadow so that It can remove check box with box shadow

 <form> <input type="button" value="Delete Checkbox" onclick="return deleteCheckbox('checkbox1','checkboxContainer')" /> <script> var checkboxObject = document.getElementById(checkBoxID); </script> <div> <div class="checkbox-1"> <div id="checkboxContainer"> <input id="checkbox1" type="checkbox" /> <p>JVC200123 <br>Acme DISC <br>1.00$ <br>Size:700 MB</p> <script> checkboxObject = document.getElementById(checkBoxID); function deleteCheckbox(checkboxID, parentID, ) { var checkboxObject = document.getElementById(checkboxID); var parentObject = document.getElementById(parentID); parentObject.removeChild(checkboxObject); } </script> </div> </div> </div>

question is not so clear, in case your main porblem is with checkbox in javascript:

so your checkbox id is "checkbox1":

<input id="checkbox1" type="checkbox" />

but in js, you put this "checkboxID" which doesn't exist.

try:

var checkboxObject = document.getElementById("checkbox1");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM