只读单选按钮,直到表单完全加载

时间:2019-02-15 08:06:13

标签: javascript

<div class="row">
    <label class="control-label col-md-2">@Html.RadioButtonFor(model => model.IsOfficial, true, new { @class = "col-md-3" }) xxx </label>
    <label class="control-label col-md-2">@Html.RadioButtonFor(model => model.IsOfficial, false, new { @class = "col-md-3" }) yyy </label>
        <div class="col-md-8">
        </div>
</div>

我有两个单选按钮。

我希望这些单选按钮是只读的,直到表单完全加载。

加载完整表单后,用户可以选择按钮

我该怎么做?

1 个答案:

答案 0 :(得分:0)

    <div class="row">
        <label class="control-label col-md-2">@Html.RadioButtonFor(model => model.IsOfficial, true, new { @class = "col-md-3", disabled = "disabled" }) xxx </label>
        <label class="control-label col-md-2">@Html.RadioButtonFor(model => model.IsOfficial, false, new { @class = "col-md-3", disabled = "disabled" }) yyy </label>
        <div class="col-md-8">
        </div>
</div>




    <script>
$(function() {
   $('[name=IsOfficial]').prop("disabled",false);
});
</script>