Skip to content

Commit

Permalink
table
Browse files Browse the repository at this point in the history
  • Loading branch information
imuniyat committed Mar 27, 2024
1 parent 0808dfe commit 4471452
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/learningmodule/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ These pre-made, introductory data science lessons are a way for students to deve
<!-- <button style="background:#3630a3;color:white;"
onclick="alert('Save processed.')">
Save</button> -->
<script src="table.js"></script>

<table class="table table-bordered table-hover table-condensed">
<thead><tr><th title="Field #1">Subject</th>
Expand Down
26 changes: 26 additions & 0 deletions content/learningmodule/table.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
function myFunction() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
// td = tr[i].getElementsByTagName("td")[0];
alltags = tr[i].getElementsByTagName("td");
isFound = false;
for(j=0; j< alltags.length; j++) {
td = alltags[j];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
j = alltags.length;
isFound = true;
}
}
}
if(!isFound && tr[i].className !== "header") {
tr[i].style.display = "none";
}
}
}

0 comments on commit 4471452

Please sign in to comment.