jus*_*eve 4 javascript c# html-helper asp.net-mvc-2
HTML帮助程序(在MVC2中)的正确语法是什么,用于定义onblur处理程序,其中使用以下代码生成文本框:
<%=Html.TextBox(
"ChooseOptions.AddCount" + order.ID,
(order.Count > 0) ? AddCount.ToString() : "",
new { @class = "{number: true} small-input" }
)
Run Code Online (Sandbox Code Playgroud)
添加onblur到htmlattributes
<%=Html.TextBox(
"ChooseOptions.AddCount" + order.ID,
(order.Count > 0) ? AddCount.ToString() : "",
new { @class = "{number: true} small-input", onblur = "alert('fired')" }
) %>
Run Code Online (Sandbox Code Playgroud)
或者更好的方法是使用jQuery添加它
$('#ChooseOptions_AddCount' + id).onblur(function() { alert('fired'); });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23948 次 |
| 最近记录: |