I'm a JS newbie trying to alter the following code. It looks like it's adding style attributes. I would like to add the class name "reveal" to this string or below. What would that syntax look like? Many thanks for your help, guys!
inline = ( elem.domEl.getAttribute( 'style' ) ) ? elem.domEl.getAttribute( 'style' ) +
'; visibility: visible; ' : 'visibility: visible; '
(I guess) the HTML may look like this:
In such case, if you do it like
then you'll get
All styles brought by class some and other are gone! You definitely don't want that, right? Also you don't want repeated classname, something like
So, here are the solutions:
The best way is to use HTML5 API
classList
:If you still want to run the code in out-dated browsers, try these: