<html>
<body>
<div id="myelement" class="classElement"></div>
<script>
function hasClass(element, clas) {
return (' ' + element.className + ' ').indexOf(' ' + clas + ' ') > -1;
}
var val1 = document.getElementById('myelement');
alert(hasClass(val1, 'classElement'));
</script>
</body>
</html>