Last active
May 4, 2017 15:49
Revisions
-
sebackend revised this gist
May 4, 2017 . 2 changed files with 57 additions and 56 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ <!-- CSS --> <style> /* enable absolute positioning */ .inner-addon { position: relative; } /* style glyph */ .inner-addon .glyphicon { position: absolute; padding: 10px; pointer-events: none; } /* align glyph */ .left-addon .glyphicon { left: 0px;} .right-addon .glyphicon { right: 0px;} /* add padding */ .left-addon input { padding-left: 30px; } .right-addon input { padding-right: 30px; } .rating .glyphicon {font-size: 22px;} .rating-num { margin-top:0px;font-size: 54px; } </style> <!-- Input text --> <div class="inner-addon left-addon"> <i class="glyphicon glyphicon-search"></i> <input id="input_text_id" type="text" autocomplete="off" class="form-control" placeholder="Filter by X..." onkeyup="filterByX()"> </div> <script> //*********************************************************************** // JS Function //*********************************************************************** function filterByX() { // Declare variables var input, filter, table, tr, td, i; input = document.getElementById("input_text_id"); filter = input.value.toUpperCase(); table = document.getElementById("table_target_id"); tr = table.getElementsByTagName("tr"); // Loop through all table rows, and hide those who don't match the search query for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[1];// This is the column index you want to filter if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } } </script> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,56 +0,0 @@ -
sebackend renamed this gist
May 4, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sebackend created this gist
May 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,56 @@ //*********************************************************************** // CSS //*********************************************************************** <style> /* enable absolute positioning */ .inner-addon { position: relative; } /* style glyph */ .inner-addon .glyphicon { position: absolute; padding: 10px; pointer-events: none; } /* align glyph */ .left-addon .glyphicon { left: 0px;} .right-addon .glyphicon { right: 0px;} /* add padding */ .left-addon input { padding-left: 30px; } .right-addon input { padding-right: 30px; } .rating .glyphicon {font-size: 22px;} .rating-num { margin-top:0px;font-size: 54px; } </style> //*********************************************************************** // Input text //*********************************************************************** <div class="inner-addon left-addon"> <i class="glyphicon glyphicon-search"></i> <input id="input_text_id" type="text" autocomplete="off" class="form-control" placeholder="Filter by X..." onkeyup="filterByX()"> </div> //*********************************************************************** // JS Function //*********************************************************************** function filterByX() { // Declare variables var input, filter, table, tr, td, i; input = document.getElementById("input_text_id"); filter = input.value.toUpperCase(); table = document.getElementById("table_target_id"); tr = table.getElementsByTagName("tr"); // Loop through all table rows, and hide those who don't match the search query for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[1];// This is the column index you want to filter if (td) { if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } }