Я хочу выделить (или цвет фона) введенный текст $ ('# Search'). Val () искомого термина в отфильтрованной строке. Я попытался обернуть его с пролетом, добавил класс и добавил CSS напрямую - не работает ...
Поле поиска (входное) имеет id = "Поиск"
<p>
<span>Search:</span>
<input type="text" id="Search" name="Search" maxlength="20" placeholder="Search" />
</p>
таблицаid = "vw"
<table id='<?php echo $vw;'>
<thead>
<tr>
<th>
<th>
<th>
</tr>
</thead>
<tbody>
<tr>
<td>
<td>
<td>
</tr>
</tbody>
</table>
$('#Search').keyup(function() {
// only search when there are 3 or more characters in the textbox
if ($('#Search').val().length > 2) {
// hide all rows
$('#' + vw + ' tr').hide();
// show the header row
$('#' + vw + ' tr:first').show();
// show the matching rows (using the containsNoCase)
$('#' + vw + ' tr td:containsNoCase(\'' + $('#Search').val() + '\')').parent().show();
// HERE - Want to hightlight(or background-color) the input text $('#Search').val() in the filtered row
// change css class to show all white records
$('#' + vw + ' tr:nth-of-type(odd)').css('background', '#fff');
} else if ($('#Search').val().length == 0) {
// if the user removed all of the text, reset the search
resetSearch();
}