Aadi
Aadi

Reputation: 7109

How add css class with Mootools

<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

Upvotes: 4

Views: 5809

Answers (1)

RDL
RDL

Reputation: 7961

MooTools does have an addClass() method. Eg:

HTML

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

Javascript

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

Upvotes: 17

Related Questions