I would like to set checkbox value with some attribute I put with PHP.
It seems weird but it’s quite simple look, here is my PHP :
<input type="checkbox" val="'.$key->mes.'" class="mes"/>
My idea : check the checkbox when the val is 1, uncheck when it’s 0
I try to figure this out with Jquery like this :
$('input:checkbox [val=1]').prop('checked', true);
But it doesn’t work… Any tips?
Since you’re working in PHP already, how about this:
Then you don’t need to do stuff client side…