-1
I need to do an if Else function in Javascript that if the column "value_set" is equal to '0,00', then the checkbox is checked, if not, the checkbox remains unchecked. This function needs to be executed when loading the page automatically.
What I’ve already tried?
$(document).ready(function () {
var valor_conjunto = '0,00';
if (valor_conjunto == '0,00') {
$('#checkbox').each(function() {
this.checked = true;
});
} else {
$('#checkbox').each(function() {
this.checked = false;
});
}
}
I’ve tried several codes, but the closest was this, I’m a beginner with Javascript, so I’m not sure I’m missing any part of the code. Fiddle link with question code: http://jsfiddle.net/fqnwphx5/3/