search in a table jquery
<script>
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>BY LOVE SINGH,
Call this function onKeyUp event of TEXTBOX.
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById("TextBoxID");
filter = input.value.toUpperCase();
table = document.getElementById("TableID");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
var x = $("#TextBoxID").val();
var regex = /^[a-zA-Z]+$/;
if (!x.match(regex)) {
td = tr[i].getElementsByTagName("td")[0];
}
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
Also in JavaScript:
- clear form inside modal after close reactjs
- validate form in reactstrap modal api
- nativescript vue get native from ref
- javascript generate a random number between two numbers thats not 1
- jquery for element which doesnt exist on page load
- referenceerror document is not defined node js
- loading screen html css js
- how to add headers to the server response node js
- url_for javascipt
- reverse array in javascript
- import menu material ui
- json-server localhost
- how to make link in discord.js
- jest mockclear
- concurrently node react
- javascript get body height
- how to make a var and sprite in javascript
- javascript convert to array
- props in react
- jquery cast to string
- express post request body undefined
- random coordinates js
- binary to ascii javascript
- parse csv javascript