I created a code to fetch information from a table and the code just does not work in Firefox
The error that appears in firefox is:
Error: Syntax error, unrecognized expression: unsupported pseudo: contains-ci jquery.min.js: 2: 12733
My code:
$(document).ready(function() {
//Começa a digitar
$("#buscar").keyup(function() {
//pega o css da tabela
var tabela = $(this).attr('alt');
if ($(this).val() != "") {
$("." + tabela + " tbody>tr").hide();
$("." + tabela + " td:contains-ci('" + $(this).val() + "')").parent("tr").show();
} else {
$("." + tabela + " tbody>tr").show();
}
});
$.extend($.expr[":"], {
"contains-ci": function(elem, i, match, array) {
return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><tableclass="table tabela" id="tabela">
<thead>
<tr>
<th>Veículo#</th>
<th>Placa</th>
<th>Tipo</th>
<th>Controle</th>
<th>Terminal</th>
<th>Rota</th>
<th>Último Odômetro</th>
<th>Leitura</th>
</tr>
</thead>
<tbody>
<tr>
<td>Porsche</td>
<td>BUD-0001</td>
<td>100</td>
<td>K</td>
<td>0</td>
<td>0</td>
<td>18/04/2017</td>
<td>1100</td>
</tr>
<tr>
<td>Ferrari</td>
<td>BUD-0002</td>
<td>100</td>
<td>K</td>
<td>0</td>
<td>0</td>
<td>19/04/2017</td>
<td>200</td>
</tr>
</tbody>
</table>
<input id="buscar" alt="tabela" type="text" class="form-control" placeholder="Buscar...">
I've already broken my mind with this. Does anyone know what can be done?