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('#report-area').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?
ID attributes are unique per-page so you can just say this:
You could also skip the
parentsaltogether and do them both at once: