Enable/Disable button in HTML using JavaScript

Categories: HTML&JS; Tagged with: ; @ August 8th, 2012 21:21

Here is a button:

<input type="button" class="buttontwofa_text" value="NEXT >" onclick="acceptAgmt()" id="buttonAccept" disabled="true"/>

And also have a radio button group to control the button:

<input type="radio" name="agrmt" value="accept" id="radioAccept" onclick="disableAcceptButton(false)"/> I accept the agreement<br />

<input type="radio" name="agrmt" value="decline" id="radioDecline" onclick="disableAcceptButton(true)"/> I do not accept the agreement

And here is the javaScript:

function disableAcceptButton(disabled) {

document.getElementById("buttonAccept").disabled = disabled;

}

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.