如何使用Mootools添加CSS类 [英] How add css class with Mootools

查看:47
本文介绍了如何使用Mootools添加CSS类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

如何通过编程在上述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>

请谅解id/name解决方案,为上述元素添加ID或名称几乎没有什么困难. 谢谢

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

推荐答案

MooTools确实具有 addClass() 方法.例如:

MooTools does have an addClass() method. Eg:

HTML

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

JavaScript

Javascript

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

这篇关于如何使用Mootools添加CSS类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆