views:

355

answers:

2

Hey,

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.

Thanks in advance.

+4  A: 

Use the :hidden selector:

$(":hidden").remove();
cletus
Thanks works great
Nic
A: 
  $("div[style*='display:none']").remove();
Vincent Ramdhanie
This is probably better than the ":hidden" selector, as the ":hidden" selector will also pick up the "visibility: hidden" style.
Graza