I'm just a beginner in jquery. I want to make a search suggestion for checkbox.
I have this piece of code that suggests searches based on labels
function studentFunction() {
var input, filter, form, label, a, i;
input = document.getElementById("studentInput");
filter = input.value.toUpperCase();
form = document.getElementById("studentUL");
label = form.getElementsByTagName("label");
for (i = 0; i < label.length; i++) {
a = label[i].getElementsByTagName("a")[0];
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
label[i].style.display = "";
} else {
label[i].style.display = "none";
}
}
}
I have this piece of code that prints out the checkbox from php to HTML
echo"<input type=\"checkbox\" name=\"check_list[]\" value=\"{$row['UserIndex']} class=\"studentUL\"\"><label><a>{$row['LName']}, {$row['FName']}, {$row['Year']}</a></label>";
If I search, it displays this If i don't search anything, it displays this
Thanks for your help :)
Aucun commentaire:
Enregistrer un commentaire