javascript - How can I show only the row of a table that has the same value that was entered in a textbox with jquery -



javascript - How can I show only the row of a table that has the same value that was entered in a textbox with jquery -

i have table of rank type id of rank , shows me column line has line code:

$('button').click(function () { var info = $("textarea").val(); var rank = $("#rank").val(); if(rank == ""){ alert("digit rank number"); } else{ info = data.replace(/\s/, " #"); info = data.replace(/([0-9]\s)/g, "$1#"); var lines = data.split("#"), output = [], i; (i = 0; < lines.length; i++) output.push("<tr><td>" + lines[i].slice(0,-1).split(",").join("</td><td>") + "</td></tr>"); output = "<table>" + output.join("") + "</table>"; var valuefinal = $(output).find('tr').filter(function(){ homecoming $(this).children('td').eq(1).text() == rank; }); $('#filedisplayarea').html(valuefinal); } });

i'm doing filter in part of code

var valuefinal = $(output).find('tr').filter(function(){ homecoming $(this).children('td').eq(1).text() == rank; }); $('#filedisplayarea').html(valuefinal);

demo code

(forgive me if did not understand something, english language sucks. hope clear need.)

you need alter -

return $(this).children('td').eq(1).text() == rank;

to -

return $(this).children('td').eq(0).text() == rank;

.eq() zero-based array method.

http://jsfiddle.net/jayblanchard/qm6fj/19/

http://api.jquery.com/eq/

javascript jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -