<div id='ID' class='notg'>asd</div> <script type="text/javascript"> if(document.getElementById("ID").className == 'notg'){ alert(document.getElementById("ID").className);} </script>