0
I created a code to search for information in a table and the code just doesn’t 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>
<table class="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 head with this. Does anyone know what can be done?
Here it worked in Firefox. Already tried to remove the caracrete
-
of the selector name?– Woss
I already did this. I changed the order too, ie I left $.extend($. expr[":"]... before $("#fetch"). keyup(Function() ... and nothing solved
– Valter Junior