可以使用以下代碼為@Html.TextBoxFor賦值:
$("#TextBoxId").val("賦值內(nèi)容");
其中,"TextBoxId"是@Html.TextBoxFor的id屬性。
document.getElementById("TextBoxId").value = "賦值內(nèi)容";
同樣,"TextBoxId"是@Html.TextBoxFor的id屬性。
注意:以上代碼需要在DOM加載完成后執(zhí)行,可以放在$(document).ready()事件中或者放在頁面底部。