alert the class name of an element using javascript -
i have element , want alert class attribute of element use code;
<li id="sss" class="settings" onclick="alertclassname(this)">1111</li>
and in alertclassname function ;
function changeclass(elem) { var x = $(elem.id); alert(x.class) ; }
it alerts undefind.
try classname
instead of class
.
onclick="alertclassname(this)"
...
function alertclassname(elem) { alert(elem.classname); }
Comments
Post a Comment