jQuery toggle() with speed

Introduction

Toggle between hide and show for a p element

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>/*from  ww w . j a  v a2  s. c om*/
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").toggle(1000);
  });
});
</script>
</head>
<body>

<button>Test</button>

<p>This is a paragraph.</p>

</body>
</html>



PreviousNext

Related