0
爲什麼第一個警報會說未定義?請注意,警報存在,並且文本框僅在我關閉警報時出現。jQuery的選擇器.attrib('id')的第一部分視圖未定義
隨後的 「新」 點擊警報 「RowId的」。在我解僱警報後,我看到兩個框。
這是我的視圖與Ajax.Action鏈接是InserterAfter。
@Ajax.ActionLink("New", "_New", new { Controller = "Test" }
, new AjaxOptions()
{ InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "divNew" })
<div id="divNew" />
這是我的偏愛。
RowId: @Html.TextBox("RowId")<br />
<script language="javascript">
$(document).ready(function()
{
alert($('input[name="RowId"]').attr('Id'));
});
</script>
+1您的意見:) – 2012-02-28 21:49:15
謝謝。我會把所有的js分開! – 2012-02-28 22:00:57
我會按照你的建議去使用jquery ajax。我打算讓.js文件像後面的代碼一樣用於視圖。 – 2012-02-28 22:02:45