1
How would I make this list display an error if the list is not found
webmunchster (1)

I am creating a news site and am wondering about how I would make the search results show "No other articles are available" When there is no more articles. The script looks something like :

function myFind() {
  var input, filter, ul, li, a, i;
  input = document.getElementById("mySearch");
  filter = input.value.toUpperCase();
  ul = document.getElementById("myMenu");
  li = ul.getElementsByTagName("li");
  for (i = 0; i < li.length; i++) {
    a = li[i].getElementsByTagName("a")[0];
    if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
      li[i].style.display = "";
    } else {
      li[i].style.display = "none";
    }
  }
}
You are viewing a single comment. View All