如果没有单击单选按钮,则禁用提交按钮

Vin*_*gno 0 html jquery radio-button

<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>
Run Code Online (Sandbox Code Playgroud)

您好,如果没有选择选项,如何禁用表单提交按钮?谢谢

Dav*_*vid 5

那么它们是单选按钮,所以它们不能被取消选中.从禁用按钮开始,如果/当选中其中一个单选按钮时,将其切换为启用:

<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");
    });
});
Run Code Online (Sandbox Code Playgroud)

的jsfiddle