Refael
asked on
jquery text contain find
Hello Experts,
Here is what i am trying to do.... hopping someone will correct me :-)
TASK:
Check if the text in the second TD (table column) starts with "xyz".
Here is what i am trying to do.... hopping someone will correct me :-)
TASK:
Check if the text in the second TD (table column) starts with "xyz".
var secondTd = $('td.eq(2)', $(this));
if (secondTd.length == 0)
return;
var text = secondTd.text();
if (text == "xyz") {
//do something....................
}
else {
} // do something else
}
ASKER
Hi BuggyCoder,
that's wrong because you check if the entire TD text string is equal ... and i am after the beginning of the string or if its easier then i can use "contain".
Here is my code again..... if you can just tell me where the problem is:
that's wrong because you check if the entire TD text string is equal ... and i am after the beginning of the string or if its easier then i can use "contain".
Here is my code again..... if you can just tell me where the problem is:
var secondTd = $('.tdlight:eq(1)', $(this));
if (secondTd.length == 0)
return;
var text = secondTd.text();
alert (text);
if ($(this).text() == "2. FLOOR") {
$('#ausblicke-etagen').show()
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great, that's what i was looking for :-)
Open in new window
Here is the jquery for comparison:-Open in new window