remove elements with "display: none;" for email using javascript

email, javascript, jquery

Solution

Use the `:hidden` selector:

$(":hidden").remove();

Problem

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.

Original source