I have the following function in JavaScript to filter data from a table, but its response time while I am writing the data to search is very slow, is there any way to optimize it?
Brother, jQuery already has the option to filter data and is very easy to use.
As simple as adding
$(document).ready(function(){
$("#buscar").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#tablaCotizaciones1 tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
Note that I add the function in the "keyup" to the text $ ("# search"), that is to say that it searches in "real time" so to speak it