/ Published in: jQuery
Handy. Hide an element as soon as possible, before document.ready. The element gets hidden but only when a class is applied to the html via js.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="../assets/js/jquery.js"></script> <script type="text/javascript"> $(function () { $('html').addClass('no-message'); }); </script> </head> <body> <style type="text/css"> html.no-message .box {display:none;} </style> <p>In other news...</p> <div class="box"><p>I shoud be hidden!</p></div> </body> </html>