I have a search bar and a table below it which has a select all option. The Select All function works fine but when I search something in the search bar and then Click on the Select All button, nothing happens. I am not able to figure out why is it so?
Here is my code for Select All function
function selectUnselectchkAllProcessedOrders() {
debugger
$("#chkAllProcessedOrders").click(function () {
var checked_status = this.checked;
$("input[name='fulfillmentOrderId']").each(function () {
this.checked = checked_status;
if (checked_status)
$(this).parent().parent().addClass('greanBackGround');
else
$(this).parent().parent().removeClass('greanBackGround');
});
});
}
when i click the Select All checkbox after clicking the search button, i can see using debugger that when the selectUnselectchkAllProcessedOrders() function is called, this.checked is undefined.
Here is the cshtml
<div>
<table>
<tr>
<td>
<label>Order Number</label></td>
<td>
<input type="text" id="TextBoxFullFillmentOrderNumber"
/></td>
<td>
<input type="submit" name="ButtonSearch" value="Search"
/>
<input type="hidden" name="posearchorderno"
id="posearchorderno" />
<input type="hidden" name="search" value="some" />
</td>
</tr>
<tr></tr>
</table>
</div>
}