Javascript examples for DOM:Element setAttribute
check if HTML style attribute exists with javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . j a v a 2s.co m*/ var contentWrapper = document.getElementById("contentWrapper"); if(!contentWrapper.getAttribute("style")) console.log("Empty"); else console.log("Not Empty"); } </script> </head> <body> <div id="contentWrapper" style=""> Hello World </div> </body> </html>