How can checkboxes to be automatically checked when $(document).ready??

How can checkboxes to be automatically checked when $(document).ready??

for example, i have 3 checkboxes with values of 1,2,4 respectively and a varible use to store their summation value, How can checkboxes to be automatically checked when the web page initialized?

when form initialise, if a variable has value of 1, that means the first checkbox need to be selected at the first, if value is 2, then 2nd checked, if 3, first 2 boxes need to be checked, value is 4, the third one checked, if 7, all the checkboxes need to be checked...