Jquery: How To Hide Tables Depending On Text Input
I have one text input box and multiple HTML-tables like this: &
Solution 1:
Try this Demo
$("#search").keyup(function () {
var txtVal = $(this).val();
if (txtVal != "") {
$(".tblDetails").show();
$(".message").remove();
$.each($('.tblDetails'), function (i, o) {
var match = $("td:contains-ci('" + txtVal + "')", this);
if (match.length > 0) $(match).parent("tr").show();
else $(this).hide();
});
} else {
// When there is no input or clean again, show everything back
$("tbody > tr", this).show();
}
if($('.tblDetails:visible').length == 0)
{
$('#search').after('<p class="message">Sorry No results found!!!</p>');
}
});
// jQuery expression for case-insensitive filter
$.extend($.expr[":"], {
"contains-ci": function (elem, i, match, array) {
return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
Element?
I have a table and I need the cells to have an element posi…
Here's a js fiddle of what I currently have, I am tryin…
So I have a few pictures that I want to randomly generate o…
This is my first question. I usually try to research these …
Right Floated Element Disappears When Using Columns In Firefox
I am using an ol element with column-count and column-gap p…
Setting Link Href From Child Image Src Using JQuery
I am using .wrap() to create a link around each image withi…
How To Limit The Html Table Records In Each Page
I am populating a table in my jsp which has more than 20 re…
I want to show countdown in each of my divs. Right now I ge…
Retain Dynamically Created DropDown List's Selected Value On Event Window.history.back()- JavaScript
Can use the below question as a reference to explain the co…
|
Post a Comment for "Jquery: How To Hide Tables Depending On Text Input"