I successfully managed to use closest() (http://api.jquery.com/closest/) to find the closest matching element by tag name. It basically goes up through DOM tree and returns element (if found) or false:
if(jQuery(".current_element").closest("p").length){ do something... }
//if above is TRUE then .current_element is nested within at least 1 "p"
Now, I’m trying to return TRUE only if any of tags (or rather the closest one to the element – the one that takes effect) have style="text-align:center;" applied. How do I do that?
It should work: