css - Javascript class Vs className -


i learning javascript , found difficulties in understanding difference between class , classname.

i wondering if there difference between class , classname. when learning javascript, found may use either of retrieve class name of specific node: e.g.

   var firstchildclass = firstchildname.classname;     var firstchildclass2 = firstchildname.getattribute('class') 

a more detailed script can found on http://jsfiddle.net/hphchan/3ze3ug7r/.

i ask in implementation, there subtle differences between two?

btw have been visited object.classname or object.getattribute("classname/class")?, , understand using getattribute('class') more universal classname since classname works on html, not others svg. difference exist between two?

thanks.

as @derek-朕會功夫 stated, getattribute onlt used retrieve value of class attribute while accessing directly classname attribute allows & set class names.

furhtermore, getattribute function works kind of attribute , use retrieve values dynamically eg getattribute(attributename).


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -