JQuery addclass to another div (but not parent) if no data is found
Posted
by
Danny
on Stack Overflow
See other posts from Stack Overflow
or by Danny
Published on 2011-11-15T01:39:48Z
Indexed on
2011/11/15
1:51 UTC
Read the original article
Hit count: 186
JavaScript
|jQuery
I have this to add a class to the main table that the report is in if there is no data returned.
$('#report-area table td:contains("Sorry, your search did not return any data")').parents('#reportArea').addClass('no-report-data')
However, I have another div area "#report-footer"
but it's not inside #report-area
. I'd like to also add the .no-report-data
class to "#report-footer"
as well but in this case I don't think the .parents
selector will work. Is there another selector I can use to do this?
© Stack Overflow or respective owner