Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
This in jquery example in Jquery functions of JQuery Examples
2943 Views
Hints 
"this" selector used to take the current selector.For example 

$("div.exam").click(function(){
  $(this).next().css("color","red");
});

In the above code this is equal to "div.exam".

Note: for this no need of double quotes.
Example code
<html>

<head>
    <title>HTML-JQuery</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

    <script type="text/javascript">
        $(function () {
            $("div.exam").click(function () {
                $(this).next().css("color", "red");
            });
        });
    </script>
</head>

<body>
    <div class="exam">Click here to make next element red.</div>
    <div>Hello i become red</div>
</body>

</html>
Demo 
Next Topics
Next lessons of current book.
Previous Topics
Previous lessons of current book.
Best Lessons of "JQuery Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details