jQuery Chaining


In jQuery you can link more then one jquery actions together.


jQuery Chaining Example And Code

jQuery Chaining Example


<script type="text/javascript">
         $(document).ready(function(){
          $("#animateButton").click(function(){
           $("#demoDiv").animate({backgroundColor:'yellow'},"slow").css("border","15px solid gray").slideUp("slow");
          });
          });
</script>    

Try it »

Some Important Points about jQuery chaining :

  • It Improves Performance
  • Method called in sqquence of right to left ie. method added first will be called first and method added in last will be called in last.
    In the above example first .animate(),.css() and then slideUp() is called

jQuery Chaining Most Used Examples

[table width=”100%” colwidth=”20|190|50″ colalign=”left|left|center|left|right”]
No, Slide Animate Effect ,Syntax, Example & Demo
1, jQuery selector chaining example,$(“selector1\,selector2\,selector3\, selector4….”).method();, Example And Demo
2, jQuery chaining animations,—–, Example And Demo
[/table]


Advertisements

Add Comment

📖 Read More