I'm generating a email from a web page and taking a section of the page and putting it into the email. The problem is the section of code has elements with "display: none;" and some email clients don't recognise the display:none property which then displays unwanted elements in the email.
I want to remove these elements using some simple javascript i already remove elements with certain classes now i want to remove elements with certain styles, the styles are inline. I'm using jquery with the site.
display:none removes the element from the document. It does not take up any space.
Style display property is used to hide and show the content of HTML DOM by accessing the DOM element using JavaScript/jQuery. To hide an element, set the style display property to “none”. document.
# How to hide elements completely Completely hiding elements can be done in 3 ways: via the CSS property display , e.g. display: none; via the CSS property visibility , e.g. visibility: hidden; via the HTML5 attribute hidden , e.g. <span hidden>
The remove() method removes an element (or node) from the document.
Use the :hidden
selector:
$(":hidden").remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With