JQuery addclass to another div (but not parent) if no data is found
- by Danny
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?