Given the following table, I know how to get the value of the first , but how can I use jquery to obtain the value of @Html.Hidden(“AccountId”)? Assume that a certain row is already selected, ala:
<script type="text/javascript>
$("#tblTaskList").delegate("tr", "click", function () {
$(this).addClass("selected").siblings().removeClass("selected");
var tids = $(this).find('td').first();
});
</script>
and here is the table:
<table id="tblTaskList">
<thead>
<tr>
<th>Ticket ID</th>
</tr>
</thead>
<tbody id="tblBody" class="tblBody">
@{for (var ix = 0; ix < Model.Value.Count - 1; ix++)
{
<tr id="@(Model.Value[ix].TicketId)">
<td style="width: 5%">@Model.Value[ix].TicketId</td>
@Html.Hidden("AccountId");
</tr>
}}
</tbody>
<table>
Thanks so much for the help
Obviously you don’t want the hidden value to be alert()’d, but didn’t know what you wanted to do with it at that point. This will give you the val() of the hidden field within that . Hope this helps!