javascript - Jquery check checkbox value then set checked -


i had checkbox

<input type="checkbox" name="paid" id="paid-change"> 

which have value = "1" or "0".i want check if checkbox value = "1" checkbox add checked status on it. tks help!

try this. code using pure javascript

var chkbox = document.getelementbyid("paid-change"); if (chkbox.value == 0)     chkbox.checked = false; else if (chkbox.value == 1)     chkbox.checked = true; 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -