Query Searching Text on Table

Hi all!

I have a table that I wanna look for a specific text, If a text exists on table Show an Alert, if not exists Show another Alert.
Example, A table of names, If the Name “Arnold” is found I say “Arnold Exists”, If not, It would say “Arnold NOT Exists!!, its a product of your twisted mind!!”

This is the Table:

<table class="X">
<tr>
<td>Antoine</td>
<td>Madelleine</td>
<td>Jerome</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>William</td>
<td>Patrick</td>
<td>Demian</td>
</tr>
<tr>
<td>Bruce</td>
<td>David</td>
<td>Arnold</td>
</tr>
</table>

And that Is what I’m doing:

if ($("table.X td:contains('Arnold')")){
alert ('Arnold Exists!!!');
} else {
alert ('Arnold NOT Exists!!!, its a product of your twisted mind!!!');
}

But nevertheless , If I do that, It paint me “Arnold” in red, using CSS:

$("table.X td:contains('Arnold')").css("background-color", "red");

What I’m doing wrong?

I answer my own Question, I was forgetting “length”:

if ($("table.X td:contains('Arnolds')").length){
alert ('Arnold Exists!!!');
} else {
alert ('Arnold NOT Exists!!!, its a product of your twisted mind!!!');
}

But what about if the Classname has spaces, Instead of be called “X”, be named “World Names”?

Again LOL :stuck_out_tongue: :

Perhaps posting that in a Javascript/jQuery forum would get more consise answers, as it is not a direct Xojo issue