How to set the checkbox value with JS? [duplicate]
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I have parent element like:
<span style=”background: yellow; padding: 50px;” onClick=”setCheckBox()”><span>
<span> </span> <input type=”checkbox” name=”f01″ value=”100″></span></span>
and js function:
function setCheckBox() {
document.getElementsByTagName(‘input'[0].checked = ‘true’;
}
Want to change the checkbox input on parent click (yellow color)
Thanks in advance!
أضف إجابة