How to programmatically add an additional...">

How to add css class using Mootools

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

How to programmatically add an additional class or another property with an existing class in the div above. I would like to do the following:

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

Sorry id/name solution, it is easy to add an identifier or name for the above element. Thanks

+4
source share
1 answer

MooTools has an addClass () method. For instance:

HTML

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

Javascript

 $('myElement').addClass('newClass'); 
+17
source

All Articles