I need to Search checkboxlist item with jQuery by TEXT of the Checkbox, not by Value.
Below code search by Value
$(document).ready(function () {
$("#maincontent_txtSearchTo").on("keyup", function () {
debugger;
var g = $(this).val().toLowerCase();
$("#maincontent_chkQuestionTo tr td input").each(function () {
var s = $(this).val().toLowerCase();
$(this).parent().parent()[s.indexOf(g) !== -1 ? 'show' : 'hide']();
});
});
});
I need it to search by TEXT.
Please see below a sample of the generated code
<input name="ctl00$maincontent$txtSearchTo" type="text" id="maincontent_txtSearchTo" Placeholder="Search..." />
<table id="maincontent_chkQuestionTo">
<tr>
<td><input id="maincontent_chkQuestionTo_0" type="checkbox" name="ctl00$maincontent$chkQuestionTo$0" value="2057" />
<label for="maincontent_chkQuestionTo_0">What is money in finance?</label>
</td>
</tr><tr>
<td><input id="maincontent_chkQuestionTo_1" type="checkbox" name="ctl00$maincontent$chkQuestionTo$1" value="2058" />
<label for="maincontent_chkQuestionTo_1">What is Good?</label>
</td>
</tr>
</table>
Grateful if you could help.
Many thanks
James
Aucun commentaire:
Enregistrer un commentaire