26 Eylül 2019 Perşembe

Tabloda Aktif Arama (JQuery)

HTML


<input type="text" class="form-control" id="search" name="search"/>
<table id="table" class="table table-striped table-bordered">
<tr>
  <th>Numara</th>
  <th>Ad Soyad</th>
  <th>Bölüm</th>
  <th>Sınıf</th>
</tr>
<tr>
  <th>123456789</th>
  <th>Ahmet Al</th>
  <th>Bilgisayar Mühendisliği</th>
  <th>2</th>
</tr>
.
.
.
</table>

JS


$("#search").on("keyup",
    function(){
      var value=$(this).val().toLowerCase();
      $("#table tr").filter(function(){
       $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
      });
    });

Hiç yorum yok:

Yorum Gönder