最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How add css class with Mootools - Stack Overflow

programmeradmin3浏览0评论
<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

<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

Share Improve this question edited Nov 18, 2010 at 6:24 BoltClock 724k165 gold badges1.4k silver badges1.4k bronze badges asked Nov 18, 2010 at 5:12 AadiAadi 7,10928 gold badges102 silver badges148 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 17

MooTools does have an addClass() method. Eg:

HTML

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

Javascript

$('myElement').addClass('newClass');
发布评论

评论列表(0)

  1. 暂无评论