$('#servertable td:eq(' + server + ')')
this finds only 1 (first I think) match, how to find all matches.
btw. td:contains will not work for me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
eqexpects a numerical index to only return a single row. If you want to match a td by its contents, you have to use the :contains selector. Saying “it doesn’t work” and throwing it away is not the right approach to the problem, as the selector is (most likely) not at fault (Do note its case sensitive, which might be it…)Anyhow, if you have a table like this:
This jQuery code:
Will turn all cells with “Hello” to red. Demo.
If you need a case insensitive match, you could do this, using the
filterfunction:If you need to match the exact contents of the cell, you could use something similar to the above:
The above is case insensitive (by turning both the search and the contents to lower case when comparing) otherwise you can just remove those if you want case sensitivity. Demo.