如何在html中的表中添加搜索

时间:2014-06-26 11:31:52

标签: javascript jquery html5 jquery-plugins

   <script src="http://listjs.com/no-cdn/list.js"></script>

   <script type="text/javascript">

    var options = {
        valueNames: ['style3', 'tf']
    };

    var journalList = new List('inner', options);



   </script>


  <div id="inner">


        <input type="text" id="search" placeholder="Search" />
        <!--<button class="sort" data-sort="name">Sort by name</button>-->


    <table id="tblcontents" border="0" >

    <thead style="width:100%">
          <tr>
          <th></th>
          <th class="sort" data-sort="style3"></th>
          <th class="sort" data-sort="tf"></th>
          <th class="sort" data-sort="tf"></th>

         </tr>

    </thead>
  <tbody>
 <tr>

<td width="76%" class="style3"><a href="#"><b>Amrita Journal of Medicine</b></a><br    /><br /><b>Started From</b><a href="#">2013</a><br /></td>
<td class="tf" ><span class="style2"><b><br /><br />Upto 2013</b></span></td>
<td class="tf" ><span class="style2"><a href="#"><br /><br />Available Issues</a>
</span></td>

</tr>
    <tr>

<td width="76%" class="style3"><a href="#"><b>Annals of Cardiac Anaesthesia    </b></a><br /><br /><b>Started From</b> <a #">2005</a> <br /><br /></td>
<td class="tf" ><span class="style2"><b><br /><br />Upto 2014</b></span></td>
<td class="tf" >
    <br />
    <br />
    <span class="style2"><a href="#">Available Issues</a>
</span></td>

</tr>

 <tr>
<td class="style3"><a href="#"><b>Asian Journal of Transfusion Science </b></a><br /><br /><b>Started From</b><a href="#">2007</a><br /><br /></td>
<td class="tf" ><span class="style2"><b><br /><br />Upto 2014</b></span></td>
<td class="tf" >
    <br />
    <br />
    <span class="style2"><a href="#">Available Issues</a>
</span></td>
</tr>

<tr>
<td class="style3"><a href="#"><b>Contemporary Clinical Dentistry </b></a><br /><br /><b>Started From</b> <a href="#">2010</a> <br /><br /></td>
<td class="tf" ><span class="style2"><b><br /><br />Upto 2014</b></span></td>
<td class="tf" >
    <br />
    <br />
    <span class="style2"><a href="#">Available Issues</a>
</span></td>
 </tr>

 <tr>
  <td class="style3"><a href="#"><b>Delhi Psychiatry Journal</b></a><br /><br /><b>Started From</b> <a href="#">2007</a><br /><br /></td>
  <td class="tf" ><span class="style2"><b><br /><br />Upto 2014</b></span></td>
<td class="tf" >
    <br />
    <br />
    <span class="style2"><a href="#">Available Issues</a>
</span></td>
</tr>
</tbody>  
</table>


    </div>

我有这个代码,我想在输入框中插入一个字符串后排序,我尝试使用link.js文件..但表格无法排序,我只想要s与我的字符串匹配的值并隐藏其余值。​​

请帮助plzz:)

提前致谢。