开发者

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

开发者 https://www.devze.com 2022-12-18 18:20 出处:网络
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 d

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开发者_如何学Go remove elements with certain styles, the styles are inline. I'm using jquery with the site.


Use the :hidden selector:

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


  $("div[style*='display:none']").remove();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号