Basically I have a text box and when I type characters into the box it hides rows in my table that don’t contain the text. How can I reform the following code so that it re-evaluates the function so that it starts showing the rows again when I press backspace?
This is as far as I got:
$("#txtFilter").keyup(function () {
var text = $("#txtFilter").val();
if () {
$(".tableStripe .tdName:not(:contains(" + text + "))").closest("tr").show();
}
else {
$(".tableStripe .tdName:not(:contains(" + text + "))").closest("tr").hide();
}
});
You need to add the
eventvar to your callback function, then specify the keycode for backspace:For more javascript keycodes, do a google search for ‘javascript keycodes’