javascript - why set both className and class? -


i no longer sure why this. read somewhere should set both class , classname

why both? why not "class". trying understand this, since every thing seems work fine "class".

$(e).attr('class','highlightme'); $(e).attr('classname','highlightme'); 

---update-----------------------------------------------------------------------------

so if want clear classes first? there might more one... this?

$(e).removeclass(); $(e).addclass('highlightme'); 

---update-----------------------------------------------------------------------------

this ended doing, seems working fine...so far

the attr initializes class... gets rid of other classes might have in there

the addclass add more classes

i not use removeclass, because not referencing element id

$(.base123).attr('class','base123'); $(.base123).addclass('highlightme blinkme'); 

both wrong, wrong strong word, there more optimal approaches such as: jquery need addclass(). if class attached element won't anything, if isn't add it. address update, calling .removeclass() (with no parameters) remove classes on element (or elements)


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -