I am facing a problem such like, I can't extract the dependent ids who are belongs to same name.
Here is my HTML
<table id="table-data" class="table table-bordered table-data" style="vertical-align: middle;">
<tbody>
<tr>
<th style="width: 15%">Project</th>
<th style="width: 15%">Module</th>
<th style="width: 15%">Relevant Client</th>
<th style="width: 20%">Task</th>
<th style="width: 5%">Hours</th>
<th style="width: 20%">Comments</th>
<th></th>
</tr>
<tr id="1045">
<input id="ChildId" name="ChildId" type="hidden" value="1045">
<td>
<select class="form-control input-sm valid" id="ProjectId0" name="ProjectId" onchange="iniatializeModuleClientAndTask(this)" onload="selecetTheTask(this)">
<option value="">--Select--</option>
<option selected="selected" value="1">Compliant Web</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ModuleId0" name="ModuleId">
<option value="">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ClientId0" name="ClientId">
<option value="">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="TaskId0" name="TaskId">
<option value="">-Select-</option>
</select>
</td>
<td>
<input class="form-control input-sm" id="ExpendedHour" name="ExpendedHour" type="text" value="4">
</td>
<td>
<input class="form-control input-sm" id="TaskComments" name="TaskComments" type="text" value="a">
</td>
<td>
<a class="removeButton btn btn-sm btn-danger" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-remove"></span></a>
<a class="addButton btn btn-sm btn-primary" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</td>
</tr>
<tr>
<input id="ChildId" name="ChildId" type="hidden" value="0">
<td>
<select class="form-control input-sm" id="ProjectId1" name="ProjectId" onchange="iniatializeModuleClientAndTask(this)">
<option value="">--Select--</option>
<option value="1">Compliant Web</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ModuleId1" name="ModuleId">
<option value="">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ClientId1" name="ClientId">
<option value="">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="TaskId1" name="TaskId">
<option value="">-Select-</option>
</select>
</td>
<td>
<input class="form-control input-sm" id="ExpendedHour" name="ExpendedHour" type="text" value="">
</td>
<td>
<input class="form-control input-sm" id="TaskComments" name="TaskComments" type="text" value="">
</td>
<td>
<a class="removeButton btn btn-sm btn-danger" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-remove"></span></a>
<a class="addButton btn btn-sm btn-primary" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</td>
</tr>
<tr>
<input id="ChildId" name="ChildId" type="hidden" value="0">
<td>
<select class="form-control input-sm" id="ProjectId2" name="ProjectId" onchange="iniatializeModuleClientAndTask(this)">
<option value="" id="ProjectId2">--Select--</option>
<option value="1">Compliant Web</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ModuleId2" name="ModuleId">
<option value="" id="ModuleId2">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ClientId2" name="ClientId">
<option value="" id="ClientId2">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="TaskId2" name="TaskId">
<option value="" id="TaskId2">-Select-</option>
</select>
</td>
<td>
<input class="form-control input-sm" id="ExpendedHouNaN" name="ExpendedHour" type="text" value="">
</td>
<td>
<input class="form-control input-sm" id="TaskCommentNaN" name="TaskComments" type="text" value="">
</td>
<td>
<a class="removeButton btn btn-sm btn-danger" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-remove"></span></a>
<a class="addButton btn btn-sm btn-primary" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</td>
</tr>
<tr>
<input id="ChildId" name="ChildId" type="hidden" value="0">
<td>
<select class="form-control input-sm" id="ProjectId3" name="ProjectId" onchange="iniatializeModuleClientAndTask(this)">
<option value="" id="ProjectId3">--Select--</option>
<option value="1">Compliant Web</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ModuleId3" name="ModuleId">
<option value="" id="ModuleId3">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="ClientId3" name="ClientId">
<option value="" id="ClientId3">-Select-</option>
</select>
</td>
<td>
<select class="form-control input-sm" id="TaskId3" name="TaskId">
<option value="" id="TaskId3">-Select-</option>
</select>
</td>
<td>
<input class="form-control input-sm" id="ExpendedHouNaNaN" name="ExpendedHour" type="text" value="">
</td>
<td>
<input class="form-control input-sm" id="TaskCommentNaNaN" name="TaskComments" type="text" value="">
</td>
<td>
<a class="removeButton btn btn-sm btn-danger" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-remove"></span></a>
<a class="addButton btn btn-sm btn-primary" style="padding:3px 0 3px 8px;"><span class="glyphicon glyphicon-plus"></span></a>
</td>
</tr>
</tbody>
</table>
Look here on my HTML code I have same name like ProjectId, ModuleId, TaskId and so many. Actually the number of table rows are propagating dynamically. So the ids are different from the name. I have done this because in MVC4 I can easily get those data by name in POST action. But I badly need to do some work on view page. So I want to count how many ids are using the same class name. I want to apply some business on those classes.
I have gone through this Question, it's quiet similar to me with a particular different. There he/she shows the ids and my difference is I want to count them. I have found also another solution answer, however it's done in CSS Badly I need it in Javascript or jQuery
Moreover the number of the ids can be as much as possible and may not be in sequence like ProjectId1, ProjectId2, then projectId99 but each of them will be under ProjectId class. therefore I want to get the total number ids by it's name. Thank you.