How add css class with Mootools

蹲街弑〆低调 提交于 2019-12-10 16:18:11

问题


<div class="generic_layout_container layout_ride_ridespec">
</div>

How to programmicaly add an extra class or one more property with existing class to above div. I would like out put as follows

<div class="generic_layout_container layout_ride_ridespec example_class">
</div>

Please excuse id/name solution, there is little difficulty to add an id or name for above element. Thanks


回答1:


MooTools does have an addClass() method. Eg:

HTML

<div id="myElement" class="testClass"></div>

Javascript

$('myElement').addClass('newClass');


来源:https://stackoverflow.com/questions/4211881/how-add-css-class-with-mootools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!