0
以下代碼段不禁用html按鈕。我正在使用MVC3剃鬚刀。任何人都可以指出我在哪裏根據您的問題您的評論腳麻MVC3 Jquery viewdata禁用按鈕
@{
bool disablebutton = bool.Parse(ViewData["Disablebutton"].ToString());
}
$(document).ready(function() {
if (@disablebutton) {
$('#abc').attr('disabled', 'disabled');
}
});
需要更多的上下文。帶有abc的按鈕在文檔中?結果HTML的樣子是什麼(即查看瀏覽器中的源代碼並粘貼它,而不僅僅是你的剃鬚刀代碼)? –
下面的代碼來自查看源代碼:(script)=「text/javascript」> $(document).ready(function(){ if(True){('#abc')。attr('disabled' ,'disabled'); } }); – user1005310
在答覆中添加了答案 –