x
 
1
<!DOCTYPE html>
2
<title>My Example</title>
3
4
<style>
5
  p {
6
    background: gold;
7
    padding: 20px;
8
  }
9
</style>
10
11
<!-- Load jQuery -->
12
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
13
14
<!-- Use jQuery -->
15
<script>
16
// Wait for DOM to load and be ready
17
$(document).ready(function(){
18
  
19
  // Listen for a click event
20
  $( "p" ).click(function() {
21
  
22
    // Fade out the current element
23
    $( this ).fadeOut();
24
    
25
  });
26
  
27
});
28
</script>
29
30
<p>1. Click me to fade me out.</p>
31
<p>2. Click me to fade me out.</p>
32
<p>3. Click me to fade me out.</p>
33
<p>4. Click me to fade me out.</p>