How can I (with PHP) remove the style attributes from DIVS having a certain class?
Because of an ‘Drag&Drop’ process some DIV elements get polluted with unnecessary styles which can lead to problems later on.
I know I can remove the style attributes with JavaScript after a ‘Drag&Drop’ process, but I only remove them when to HTML is being processed by the server (For sending the HTML as an e-mail).
This isn’t a particularly difficult problem, so far as I can tell. You need to load the HTML into a DOMDocument structure, then use a simple XPath attribute selector to find the relevant elements and
DOMElement::removeAttributeto remove the style attribute. Your code might look like this: