dimanche 27 avril 2014

Jquery script not firing


Vote count:

0




I am new to jquery usage. I have reproducing a working example from internet for filtering table row using jquery. The table contains two columns and corresponding values in it.But When I run the program using jquery to filter the row after following the instructions, I am unable to filter the rows with my query. I have no clue where my mistake is and dont know if jquery actually fires. Here is code which I included in head section of JSP page


<script src="http://ift.tt/1ivfyTP"></script><script type= "text/javascript"> $("#searchInput").keyup(function() { var rows = $("#fbody").find("tr").hide(); var data = this.value.split(" "); $.each(data, function(i, v) { rows.filter(":contains('" + v + "')").show(); }); });


Here is the code which I included in body section of JSP page which consists of table with entries


<body> <input id="searchInput" placeholder="Type To Filter"><br/><table> <thead> <tr><th>Column1</th> <th>Column2</th></tr> </thead> <tbody id="fbody"> <tr><td>cat</td><td>one</td></tr> <tr><td>dog</td><td>two</td></tr> <tr><td>cat</td><td>three</td></tr> <tr><td>moose</td><td>four</td> </tr><tr><td>mouse</td><td>five</td> </tr><tr><td>dog</td><td>six</td> </tr></tbody> </table> </body>


Kindly guide me.



asked 41 secs ago






Aucun commentaire:

Enregistrer un commentaire