Hi
I am trying to disable the submit button on my form, until a tick box is checked but it is not working properly.
The Submit button is disabled at the start of the form loading, but does not enable when the checkbox is clicked.
Can anyone see what I am doing wrong ?
Here is the code placed in the onload JS code
Thanks Laurie
I am trying to disable the submit button on my form, until a tick box is checked but it is not working properly.
The Submit button is disabled at the start of the form loading, but does not enable when the checkbox is clicked.
Can anyone see what I am doing wrong ?
Here is the code placed in the onload JS code
// stop the code executing
// until the page is loaded in the browser
window.addEvent('load', function() {
// function to enable and disable the submit button
function agree() {
if ( $('terms00').checked == true ) {
$('submit').disabled = false;
alert('checked!');
} else {
$('submit').disabled = true;
alert('Not checked!');
}
};
// disable the submit button on load
$('submit').disabled = true;
//execute the function when the checkbox is clicked $('terms00').addEvent('click', agree);
});
Thanks Laurie