I would like to use a button to be able to Mark / Uncheck checkbox. I have this button that calls a function, see:
<button class='btn btn-large' type='button' title='Todos' id='todos' onclick='marcardesmarcar();' ><i class='icon-large icon-ok'></i></button>
The function:
function marcardesmarcar(){
$('.marcar').each(
function(){
if ($(".marcar").prop( "checked"))
$(this).attr("checked", false);
else $(this).attr("checked", true);
}
);
}
The checks are as follows:
<input type='checkbox' class='marcar' name='check[]'/>
This script does the right thing the first time, but on the second it does nothing.