4
<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 Answer 1

17

MooTools does have an addClass() method. Eg:

HTML

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

Javascript

$('myElement').addClass('newClass');
Sign up to request clarification or add additional context in comments.

3 Comments

+1 Heh, but surely my answer is shorter and easier to read :p
@karim79 your answer is totally valid!
@YannisDran it would appear he deleted it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.