Wednesday, 15 July 2015

javascript - selecting a table row which contains a tr with a certain text with jQuery using .filter() -


I am trying to select the row in the table containing one td Using a jQuery .filter () function, with a specific text: My function looks like this ....

  function getBudgetRowByType (service system) {warning (serviceTypeNum); If (parseInt (serviceTypeNum) == 1) {var line = $ ('.bgTablePopUp> gt; ct & gt; tr'). Filter (function () {$ (this). Children ("td: contains ('instruction')");}); Return line; } Else if (parseInt (serviceTypeNum) == 2) {var line = $ ('.bgTablePopUp> group & gt; tr'). Filter (function () {$ (this). Children ("td: contains');}); Return line; } Else if (parseInt (serviceTypeNum) == 3) {var line = $ ('.bgTablePopUp> entity & gt; tr'). Filter (function () {$ (this). Children ("td: contains ('administration')"};}); Return line; } Other {// Other Nada returns empty; }}   

html will look something like this ...

  & lt; Table & gt; & Lt; TR & gt; & Lt; TD & gt; Instructions & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Research & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Administration & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; TD & gt; ... & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt;   

I'm getting an undefined result and I'm not sure why ...



No comments:

Post a Comment