jquery exercises

jQuery Effect: Animates all shown paragraphs to hide slowly

jQuery Effect : Exercise-10 with Solution

Animates all shown paragraphs to hide slowly (complete the animation within specified time).

Sample Data :

HTML code:

<p>User ID : <input type="text" id='field1'></p>
<p>Password : <input type="password" id='field2'>

Solution :

HTML Code:

<!DOCTYPE html>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
	 p {
	   background: #EEF4ED;
	   font-weight: bold;
  <meta charset="utf-8">
  <title>Animates all shown paragraphs to hide slowly </title>
<button>Click to hide the following paragraphs</button>
<p>jQuery Exercises</p>

JavaScript Code :

$( "button" ).click(function() {
  $( "p" ).hide(3000);

Note :
In jQuery hide( [duration ] [, complete ] ) method is used to Hide the matched elements. It has the following parameters :

  • duration (default: 400) : A string or number determining how long the animation will run. [Type: Number or String]

Live Demo:

See the Pen jquery-effect-exercise-10 by w3resource (@w3resource) on CodePen.

Contribute your code and comments through Disqus.

Previous: Finish a currently running animation.
Next: Run an animation with less frames.

What is the difficulty level of this exercise?

New Content: Composer: Dependency manager for PHP, R Programming