how to add class using javascript in div
- by Fahim Parkar
I have so many modules and I am showing border to each module.
Below is what I have
div.ja-moduletable-inner,
div.moduletable-inner {
background: none;
padding: 1.5em;
box-shadow: 0px 0px 3px 3px rgba(0,0,0,.25);
}
<div id="Mod143">
<div class="moduletable-inner clearfix">
</div>
</div>
<div id="Mod148">
<div class="moduletable-inner clearfix">
</div>
</div>
<div id="Mod149">
<div class="moduletable-inner clearfix">
</div>
</div>
Note : These modules are added by-default by Joomla, so I can't handle this. What I want is using Javascript, I want to add class in Mod149 so that I will have it as
<div id="Mod149">
<div class="moduletable-inner clearfix newMyOwnClass">`
^^^^^^^^^^^^^^
</div>
and I will have in css as
div.newMyOwnClass {
box-shadow: 0px 0px 0px 0px rgba(0,0,0,.25);
^^^^^^^
}
Any idea how to get this done in Javascript?
No jQuery... Only Javascript AND only with div id Mod149