JavaScript 関数 (jQuery) で「StudentID」値にアクセスするにはどうすればよいですか。
HTML:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Student.Models.vwStudent>>" %>
<div class="divClass">
<table class="tableClass">
<% foreach (var item in Model) { %>
<tr class="trClass">
<td class="tdClass">
<%= Html.TextBox("StudentID") %>
</td>
</tr>
<% } %>
</table>
</div>
JQuery:
$('#ShowStudentID').click(function () {
$(".tdClass").each(function () {
alert($(this).val());
});
});
マスター (フォーム):
<% using(Html.BeginForm("SaveCommitment", "LPForm")) %>
<% { %>
<div>
<% Html.RenderPartial("DisplayStudents"); %>
</div>
<% } %>
<br/><br/>
<input type="button" id="ShowStudentID" name="ShowStudentID" value="Show StudentID" />
</div>
text() 、 innerHTML() 、および innerText() メソッドを使用してみましたが、これを機能させることができません。どんな助けでも大歓迎です。
前もって感謝します