0

My Html mark-up is somthing like this

<div>
    <div></div>
    <div></div>
    <div></div>
    <div class="last">
         <div class="a">
                 <div class="b">
                        <div class="c"></div>
                 </div>
         </div>

    </div>

</div>

Want to add a extra class in <div class="last">,<div class="a">,<div class="b">, and <div class="c">. Using jQuery

2 Answers 2

3
$('div:last').addClass('yourclass');
Sign up to request clarification or add additional context in comments.

Comments

-1

See Demo Here :)

Last div:

$('div.last').addClass('class');

Last div of the last div:

$('div.last').find('div:last').addClass('class');

See more info about:

addClass
:last

Comments

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.