I tried to select all the tr’s that have id’s that contain a variable.
It’s supposed to hide elements that don’t match as the user types into the search form.
The form has an id of #search.
$(function () {
var content = $('#search').val();
$('#search').keyup(function () {
if ($('#search').text() != content) {
content = $('#search').val();
//content has changed, do stuff
if (!$('tr.id:contains(content)')) {
$('this').hide();
}
}
});
});
You could try this:
The
*=thing in an attribute match clause says to match any tag that’s got the indicated attribute with a value that contains the substring on the right, which I think is exactly what you’re asking for.