In the below code snippet, I want to get the value for "@Html.EditorFor" using Jquery. I have tried many ways to get. but I couldn't. Thank you for any inputs.
<table class="table table-striped" id="tblEvents">
<thead>
<tr>
<th class="col-md-6 Subheading-2">Event Name</th>
<th class="col-md-6 Subheading-2">Event Date</th>
</tr>
</thead>
<tbody>
@for(int i=0;i<Model.ModelEvents.Count;i++)
{
<tr>
<td class="col-md-6">
@Html.HiddenFor(model=>model.ModelEvents[i].NAME)
@Html.HiddenFor(model=>model.ModelEvents[i].ADDRESS)
@Html.HiddenFor(model=>model.ModelEvents[i].PINCODE)
@Html.DropDownListFor(model=>model.ModelEvents[i].EVENTNAME,new SelectList(Model.Events,"Value","Text",Model.ModelEvents[i].EVENTNAME),new { @class = "form-control eventname", style = "max-width:300px" })
</td>
<td class="col-md-6">
@Html.EditorFor(model => model.ModelEvents[i].EVENTDATE, new { @class = "text form-control eventdate" })
</td>
</tr>
}
</tbody>
</table>
EDIT
give the control an id and as it's in a loop include "i" to ensure a unique ID
you can then use this id as a reference for jquery to find
This will match any input whose ID starts with "foo_" so will match "foo_0", "foo_1", "foo_2" ect
I hope this helps