如果选中复选框,如何禁用或启用引导提交按钮

osb*_*gon 3 checkbox disabled-control twitter-bootstrap

如果选中或不选中复选框,我需要启用或禁用表单上的引导提交按钮

echo "<div class='panel panel-danger'><div class='panel-heading'>OBSERVACIONES</div><div class='panel-body'>";
echo "<div class='input-group'>";
echo "<label class='checkbox-inline'><input type='checkbox' name='visto' id='visto' value=''> Visto bueno del Responsable</label>";
echo "</div>"; 
echo "</div>"; 

...

echo "<input type='submit' class='btn btn-primary' value='SAVE' name='grabaperaus' formaction='update.php'>";
Run Code Online (Sandbox Code Playgroud)

Cod*_*ast 9

对于复选框,您需要做的就是获取Id您的提交button(grabaperaus在这种情况下)禁用它的onChange事件checkbox.

<input type="checkbox"  
onchange="document.getElementById('grabaperaus').disabled = !this.checked;" name='visto' 
id='visto'/>
Run Code Online (Sandbox Code Playgroud)