top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is use for chaining method in jquery ?

0 votes
329 views

Please explain with some examples .

posted Jul 25, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

In jquery there is a technique called chaining, that allows us to run multiple jquery commands, one after the other, on the same element(s).
This way, browsers do not have to find the same element(s) more than once.To chain an action, you simply append the action to the previous action.

The following example chains together the css(), slideUp(), and slideDown() methods. The "p1" element first changes to red, then it slides up, and then it slides down:

Example:

<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function()
  {
  $("button").click(function(){
    $("#p1").css("color","red").slideUp(2000).slideDown(2000);
  });
});
</script>
</head>
<body>

<p id="p1">jQuery is fun!!</p>
<button>Click me</button>

</body>
</html>
answer Jul 29, 2014 by Amit Kumar Pandey
Similar Questions
+1 vote

Also tell me how to use this noConflict() method.

0 votes

Please help any one with some basic examples.Am new to j query.

...