Submit button greyed out until checkbox checked

How can I use Javascript to make a submit button greyed out until checkbox checked in the form?
a204801Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
leakim971Connect With a Mentor PluritechnicianCommented:
<input id="Submit" type="submit" disabled="disabled" value="Submit" />

<input type="checkbox" id="terms" onclick="if(this.checked) document.getElementById('Submit').removeAttribute('disabled');else document.getElementById('Submit').disabled = 'disabled'">

test page : http://jsfiddle.net/NspG7/
0
 
leakim971PluritechnicianCommented:
another one, just put the following in the head section : http://jsfiddle.net/NspG7/2/
<script language="javascript" type="text/javascript">
window.onload = function() {
    document.getElementById("terms").onchange = function() {
        if(this.checked) {
            document.getElementById('Submit').removeAttribute('disabled');
        }
        else {
            document.getElementById('Submit').disabled = 'disabled';
        }
    }
}
</script>

Open in new window


terms is the ID of your checkbox
Submit is the ID of your submit button
0
All Courses

From novice to tech pro — start learning today.