<tr>
<td height="250px" width="300px"><center><label><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="LBC") echo "checked";?> value="LBC"><img src="../paymentoptions/lbc.png" alt="LBC" class="picture" width="245px" style="margin:10px"/></label></td>
<td height="250px" width="300px"><center><label><input type="radio" name="carrier" <?php if (isset($carrier) && $carrier=="PickUp") echo "checked";?> value="PickUp"><img src="../paymentoptions/pickup.jpg" alt="Pick-Up" class="picture" height="210px" width="250px" style="margin:10px"/></label></td>
</tr>
您好,如果没有选择任何选项,我该如何禁用我的表单提交按钮?谢谢
最佳答案
好吧,它们是单选按钮,所以不能取消选中它们。从禁用按钮开始,如果/当其中一个单选按钮被选中时,将其切换为启用:
<input type="submit" disabled="disabled" value="submit" name="submit"/>
//Begin JS
$(function(){
$("input[type='radio']").change(function(){
$("input[type='submit']").prop("disabled", false);
//Or
//$("input[type='submit']").removeAttr("disabled");
});
});
关于jquery - 如果没有单击单选按钮,则禁用提交按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26081761/