I have a rather (for me) complicated task with jQuery.
I want to scan an entire table for its th elements. If a th element has a ASTERISK (*) in it, I want to highlight the the parent, which is the tr element.
I know it sounds complicated when I explain it 🙂
So imagine I have a dynamic html table where I want to enable a feature to higlight certain rows. Therefore I just want to put some symbol (in my case an Asterisk *) to some text inside of a table cell. if jQuery detects a asterisk inside of th it should automatically give its parent() a classname!
A start would be probably an each function:
$(function() {
$("table tr th").each(function() {
$(this).parent().addClass("special");
});
});
but I have no idea how to scan for the asterisk!
This could help:
EDIT: You’d probably want the
thitself to have aspecialclass as in the demo here