Refael
asked on
jQuery find and contains
Hello Experts,
I am trying to:
1. Find the TD in a table that its text is equal to the "loftNo" variable.
2. Then go to the next TD and grab its text.
Help! Today my brain doesn't work!!!!
I am trying to:
1. Find the TD in a table that its text is equal to the "loftNo" variable.
2. Then go to the next TD and grab its text.
Help! Today my brain doesn't work!!!!
$('area').each(function() {
var loftNo = $(this).attr("id");
var LoftType = $("td:first:contains("+loftNo+")").next().text();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just make sure you pass unique values... if you pass "002" and we have 2 td, texts are joined :)
if i change my 3rd row td value to "002" and try that code, I will get "bc"
if i change my 3rd row td value to "002" and try that code, I will get "bc"
ASKER
Hi Huseyin KAHRAMAN :-) Thank you.
I think the problem was that i was searching on the first TD only. So I have changed it to "nth-child" and it looks that it is working fine. Yes filter would work better when dealing with duplicate values.
I think the problem was that i was searching on the first TD only. So I have changed it to "nth-child" and it looks that it is working fine. Yes filter would work better when dealing with duplicate values.
$("td:nth-child(1):contains("+loftNo+")").next().text();
ASKER
Thank you Huseyin KAHRAMAN :-))
oops, my nick should be "HainKurt" :) I made a mistake and put my f&l name somewhere...
fixed it by removing First & Last Name on profile page :)
fixed it by removing First & Last Name on profile page :)
please provide a link to your website
$("table td[text='" +leftNo + "']").next().text()