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
  // Click event handler
20
  $( "button" ).click(function() {
21
  
22
    // Fade out the element
23
    $( "#hideMe" ).fadeOut();
24
    
25
  });
26
  
27
});
28
</script>
29
<button>Fade out the element</button>
30
<p id="hideMe">Click the button to fade me out.</p>
31
<p>I'll remain visible.</p>