Cannot get javascript to enable a disabled submit button

Posted on 2011-10-27
Last Modified: 2012-08-14
So I have a submit button that I have disabled using the following:
<body onload="document.aasurvey.saveForm.disabled=true">

This part works, when the page loads the button is disabled. The part that's not working is the script that enables the button when a checkbox is clicked, seen here (this is between the <head> tags):
<script type="text/javascript">
function checkTerms() {



And here are the related parts of the form:
<form id="aasurvey" name="aasurvey" class="appnitro"  method="post" action="submit.php">

<input id="terms" name="terms" onclick="checkTerms()" class="element checkbox" type="checkbox" value="1" />
<label class="choice" for="element_8_1">I certify that the statements I have made on this form are true and correct and without material omission.  This form is kept strictly confidential and will not be disclosed to anyone.</label>

<input id="saveForm" class="button_text" type="submit" name="saveForm" value="Submit" />

No matter what I try I can't get the button enabled after clicking the checkbox. If anyone can help it would be greatly appreciated!
Question by:ITNC
    LVL 58

    Expert Comment

    Try changing

    <input id="terms" name="terms" onclick="checkTerms()" class="element checkbox" type="checkbox" value="1" />


    <input id="terms" name="terms" onclick="this.form.saveForm.disabled=!this.checked;" class="element checkbox" type="checkbox" value="1" />
    LVL 11

    Accepted Solution

    Works for me. Do you have some other error in the form like another element with the id="terms" in it or something?

    Author Closing Comment

    My code was working, the problem was being caused by another script I had attached to that page. The site that MacAnthony showed me ( is amazing and confirmed my syntax was correct.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Article by: DanRollins
    This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (, we'll extend the program by adding a depth-…
    This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
    Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now