7 examples of 'search in table jquery' in JavaScript

Every line of 'search in table jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
1function searchTable(table_name, search_bar_name) {
2 var searchTerms = document.getElementById(search_bar_name);
3 var filter = searchTerms.value.toLowerCase();
4 var table = document.getElementById(table_name);
5 var tableRecords = table.getElementsByTagName("tr");
6
7 for (var i = 1; i < tableRecords.length; ++i) {
8 var record = tableRecords[i];
9 var tds = record.getElementsByTagName("td");
10 var anyMatch = false;
11 for (var j = 0; j < tds.length; ++j) {
12 var td = tds[j]
13 if ((td.textContent || td.innerText).toLowerCase().indexOf(filter) >= 0) {
14 anyMatch = true;
15 break;
16 }
17 }
18 if (anyMatch)
19 record.style.display = "";
20 else
21 record.style.display = "none";
22 }
23}
115function findText(row, search){
116 var iter = document.createNodeIterator(row, NodeFilter.SHOW_TEXT, null);
117
118 while (n = iter.nextNode()){
119 var elementText = n.nodeValue;
120 if(elementText == undefined)
121 continue;
122 if(elementText.toLowerCase().indexOf(search) != -1
123 // check that it's not decoration
124 && acceptTextForSearch(n)){
125 iter.detach();
126 return true;
127 }
128 }
129 iter.detach();
130 return false;
131}
57function doSearch(columnId) {
58 cId = columnId;
59 $('#easyui-datagrid').datagrid('load', {
60 columnId: columnId,
61 filter: $('#filter').val()
62 });
63}
100function search(query) {
101 var documents = findRelevantDocuments(query);
102 var resultsList = $('#results-list .search');
103
104 $('#searching-in-progress').hide();
105
106 if (documents.length == 0) {
107 $('#nothing-found').show();
108 return;
109
110 } else if (documents.length == 1) {
111 $("#number-of-results").text("Found 1 relevant page");
112 $('#results').show();
113
114 } else {
115 $("#number-of-results").text("Found " + documents.length + " relevant pages");
116 $('#results').show();
117 }
118
119 $.each(documents, function (i, document) {
120 var documentElement = $('<li></li>'),
121 link = $('<a>', {text: document.title, href: document.uri}),
122 snippet, tag;
123
124 if (document.tag) {
125 tag = $('<span>', {text: document.tag, class: "tag"});
126 tag.appendTo(documentElement);
127 }
128
129 link.appendTo(documentElement);
130
131 if (document.snippet != '') {
132 snippet = $('<p>', {text: document.snippet});
133 snippet.appendTo(documentElement);
134 }
135
136 documentElement.appendTo(resultsList);
137 });
138}</p></span></a>
1691initSearchText () {
1692 if (this.options.search) {
1693 this.searchText = ''
1694 if (this.options.searchText !== '') {
1695 const $search = this.$toolbar.find('.search input')
1696 $search.val(this.options.searchText)
1697 this.onSearch({currentTarget: $search, firedByInitSearchText: true})
1698 }
1699 }
1700}
206function doSearch (keyword) {
207 showFlag = 0;
208 $("#meta-info").text(msg.loading);
209 if (keyword) {
210 dbSearchBook(keyword);
211 ggSearchBook(keyword);
212 }
213}
100search(e) {
101 const query = e.target.value;
102 const list = document.querySelectorAll('div[data-file-path]');
103
104 for (let i = 0; i &lt; list.length; i++) {
105 const name = list[i].firstChild.innerText.toLowerCase();
106 if (query.trim() === '' || name.includes(query)) {
107 list[i].style.display = 'grid';
108 } else {
109 list[i].style.display = 'none';
110 }
111 }
112}

Related snippets