Ticker

6/recent/ticker-posts

Create Responsive Table

 




 

Above</style>


* {
  box-sizing: border-box;
}

#myInput {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
}

#myTable {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #ddd;
  font-size: 18px;
  background-color: #bbbbbb;
}

#myTable th, #myTable td {
  text-align: left;
  padding: 12px;
}

#myTable tr {
  border-bottom: 1px solid #ddd;
}

#myTable tr.header, #myTable tr:hover {
  background-color: #d7d7d7;
}

Posts ka under

<br><input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search In Table.." title="Type in a name">

<table id="myTable">
  <tr class="header">
    <th style="width:60%;">Movie</th>
    <th style="width:40%;">Actor</th>
  </tr>
  <tr>
    <td>Radhe</td>
    <td>Salman Khan</td>
  </tr>
  <tr>
    <td>Roohi</td>
    <td>Rajkummar Rao</td>
  </tr>
  <tr>
    <td>Mumbai Saga</td>
    <td>John Abraham</td>
  </tr>
  <tr>
    <td>Time to Dance</td>
    <td>Sooraj Pancholi</td>
  </tr>
  <tr>
    <td>Raat Akeli Hai</td>
    <td>Nawazuddin Siddiqui</td>
  </tr>
  <tr>
    <td>AK vs AK</td>
    <td>Anil Kapoor</td>
  </tr>
  <tr>
    <td>Laxmii</td>
    <td>Akshay Kumar</td>
  </tr>
  <tr>
    <td>Baaghi 3</td>
    <td>Tiger Shroff</td>
  <tr>  
    <td>Radhe</td>
    <td>Salman Khan</td>
   </tr>
  <tr>
    <td>Roohi</td>
    <td>Rajkummar Rao</td>
  </tr>
  <tr>
    <td>Mumbai Saga</td>
    <td>John Abraham</td>
  </tr>
  <tr>
    <td>Time to Dance</td>
    <td>Sooraj Pancholi</td>
  </tr>
  <tr>
    <td>Raat Akeli Hai</td>
    <td>Nawazuddin Siddiqui</td>
  </tr>
  <tr>
    <td>AK vs AK</td>
    <td>Anil Kapoor</td>
  </tr>
  <tr>
    <td>Laxmii</td>
    <td>Akshay Kumar</td>
  </tr>
  <tr>
    <td>Baaghi 3</td>
    <td>Tiger Shroff</td>
  </tr>
</table>

<script>
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];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>





Post a Comment

0 Comments