Javascript 如何在jquery中禁用Html.RadioButtonNfN?

Javascript 如何在jquery中禁用Html.RadioButtonNfN?,javascript,jquery,html,asp.net-mvc,Javascript,Jquery,Html,Asp.net Mvc,这是我的Html.RadioButton <label class="radio-inline">@Html.RadioButtonFor(x => x.Account, Account.A1)<label for="Account"></label>A</label> <label class="radio-inline">@Html.RadioButtonFor(x => x.Account, Account.A2)

这是我的Html.RadioButton

 <label class="radio-inline">@Html.RadioButtonFor(x => x.Account, Account.A1)<label for="Account"></label>A</label>
 <label class="radio-inline">@Html.RadioButtonFor(x => x.Account, Account.A2)<label for="Account"></label>B</label>
@Html.radiobutton(x=>x.Account,Account.A1)A
@RadioButton(x=>x.Account,Account.A2)B

在jQuery中也使用
prop

$('input[name=ticketID]').prop("disabled",true);
您还可以在代码中使用
toggleDisabled
作为通用函数

(function($) {
    $.fn.toggleDisabled = function(){
        return this.each(function(){
            this.disabled = !this.disabled;
        });
    };
})(jQuery);
(函数($){
$.fn.toggleDisabled=函数(){
返回此值。每个(函数(){
this.disabled=!this.disabled;
});
};
})(jQuery);
$(“按钮”)。单击(函数(){
$('input[name=ticketID]')。toggleDisabled();
});

无线电广播

按钮
您不需要在此处使用jquery,您可以在RadioButton方法中将值作为html属性传递:

@Html.RadioButtonFor(x => x.Account, Account.A1, new {disabled = "disabled"} )

他从jQuery dude那里问过。@Loading..:如果可以通过添加简单属性来实现,那么将事情复杂化有什么意义呢?这不是复杂性的问题,而是问题所在。仅从Jquery中请求。