0
Personal need to mark all checkbox of my system using javascript, however want to mark the checkbox through id, how do I do this? I’m doing it this way, but it’s not working:
function marcarTodos(marcar,cont){
var id = document.getElementById(cont);
if(marcar){
document.getElementById(id).innerHTML = 'Desmarcar Todos';
}else{
document.getElementById(id).innerHTML = 'Marcar Todos';
}
var i = 0;
for(i=0; i<id.length;i++){
id[i].checked = marcar;
}
}
You are using Jquery or need to be pure Javascript ?
– Lucas Queiroz Ribeiro
Hello Lucas, I’m using pure js but can be in both.
– gemerich