How to check if checkbox is checked in mootools
Posted by chaabant on Sep 6, 2010
Hello , what is the query to test if a checkbox is checked in mootools ?
i need this to add the checkbox ” I HAVE READ AND AGREED TO THE FOLLOWING TERMS AND CONDITIONS ” before a submit button .
The answer to this question is very simple …
all what you need to do is test the following :
1 2 3 4 5 6 7 8 9 10 11 12 |
window.addEvent('load', function() { // Checkbox ID = termOfUsage // Button ID = informationsButton $('termOfUsage').addEvent('click',function(event) { val = $('termOfUsage').checked; if(val) { $('informationsButton').set('disabled',false); } else { $('informationsButton').set('disabled',true); } }); }); |
window.addEvent('load', function() {
// Checkbox ID = termOfUsage
// Button ID = informationsButton
$('termOfUsage').addEvent('click',function(event) {
val = $('termOfUsage').checked;
if(val) { $('informationsButton').set('disabled',false); }
else { $('informationsButton').set('disabled',true); }
});
});
Posted in Mootools || No Comments »