Chaining Methods

<p id="chainText">Watch me change!</p>
<button id="chainBtn">Start</button>

<script>
$(document).ready(function(){
  $("#chainBtn").click(function(){
$("#chainText").css("color", "red")
               .slideUp(1000)
               .slideDown(1000);
}); }); </script>

jQuery allows chaining multiple methods in sequence.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *