我的表单底部有这样的代码.
<p>
<input type="checkbox" id="agreed">
I agree to keep my Username and Password confidential and uphold
the integrity of this pharmacy
</p>
<input type="submit" id="submit" disabled class="formbutton button-primary" value="Go">
Run Code Online (Sandbox Code Playgroud)
我希望这个JavaScript中的监听器能够启用提交按钮.我知道它可能是错误的,但我的JavaScript看起来有点像这样
function track() {
if ( document.getElementById("agreed").checked==true ) {
document.getElementById("submit").removeAttribute("disabled");
} else {
document.getElementById("agreed").checked==false
}
};
Run Code Online (Sandbox Code Playgroud)