Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
How to addclass and removeclass in jquery
addClass() and removeClass() functions are used to add and remove the class dynamically to the elements.
Example : 1 when you click first element class added to the second element.When you click third element the class removed from the second element.
Example: 1

    <script type="text/javascript" src=""></script>

    <script type="text/javascript">
        $(document).ready(function () {
            $(".one").click(function () {
            $(".three").click(function () {
        .selected {
            color: red;
            font-size: 20px;

    <div class="one">click here to add class name 'selected' with next element</div>
    <div class="two">After click the element the selected class css applied here</div>
    <div class="three">click here to remove class name 'selected' from the above element</div>

Example: 1 Demo 
Best Lessons of "JQuery Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details