Guest User

Untitled

a guest
Jan 22nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. function search() {
  2. var input, filter, found, table, tr, td, i, j;
  3. input = document.getElementById("myInput");
  4. filter = input.value.toUpperCase();
  5. table = document.getElementById("myTable");
  6. table.style.display = "block";
  7. tr = table.getElementsByTagName("tr");
  8. for (i = 0; i < tr.length; i++) {
  9. td = tr[i].getElementsByTagName("td");
  10. for (j = 0; j < td.length; j++) {
  11. if (td[j].innerHTML.toUpperCase().indexOf(filter) > -1) {
  12. found = true;
  13. }
  14. }
  15. if (found) {
  16. tr[i].style.display = "";
  17. found = false;
  18. } else if (!tr[i].id.match('^tableHeader')) {
  19. tr[i].style.display = "none";
  20. }
  21. }
  22.  
  23. <table id="myTable">
  24. <tr>
  25. {% for key, value in list.items() %}
  26. <td>{{ key|e }</td>
  27. <td id="name">{{ value|e }}</td>
  28. <td>
  29. <form class="form-signin ajax" action="/signIn" method="post" data-replace="#res" role="form">
  30. <input type="checkbox" name="watchlist" value="Watchlist" onclick="writeToCell (this.id)" id="{{ key|e }}">
  31. </form>
  32. </td>
  33. </tr>
  34. {% endfor %}
  35. </table>
Add Comment
Please, Sign In to add comment