This is my code:
function search() {
$("#myInput").keyup(function () {
var value = this.value;
$("table").find("tr").each(function (index) {
if (index === 0) return;
var id = $(this).find("td").first().text();
$(this).toggle(id.indexOf(value) !== -1);
});
});
}
$('body').on('click', '#searchFonts', function () {
var value = "Font"
$("table").find("tr").each(function (index) {
if (index === 0) return;
var id = $(this).find("td").first().text();
$(this).toggle(id.indexOf(value) !== -1);
});
});
$('body').on('click', '#searchScripts ', function () {
var value = "script"
$("table").find("tr").each(function (index) {
if (index === 0) return;
var id = $(this).find("td").first().text();
$(this).toggle(id.indexOf(value) !== -1);
});
});
I'm looking for ways to make this run more effectively, as I'm sure there is a more efficient way to search for the specific value's seen below such as 'Font' and 'Script'.