Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

search content in js

// Programmed by RIMON, the programming king!
const $_ = {
  e:function(e) {return document.querySelector(e)},
  ea:function(e) {return document.querySelectorAll(e)},
}
const si = $_.e('#search-todos');
si.oninput=function(){_search_(this.value)};
function _search_(v) {
  var v_ = v.toLowerCase();
  const tds = $_.ea('#lists span');
  for(var i=0;i<tds.length;i++) {
    tds[i].parentElement.parentElement.style.display = 'none';
    var c_t = tds[i].innerHTML.toLowerCase();
    if(c_t.indexOf(v_) !== -1) {
      tds[i].parentElement.parentElement.style.display = 'block';
    }
  }
}
 
PREVIOUS NEXT
Tagged: #search #content #js
ADD COMMENT
Topic
Name
8+7 =