jQuery examples with source code

There are many features, in built functions and effects in jQuery and millions of associated examples. Some of the simple examples of jQuery are discussed below.

Example 1

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$("p").click(function(){
    	$(this).hide();
	});
});
</script>
</head>
<body>
 
<p>Hello world</p>
<p>If you don’t like me, click me away!</p>
 
</body>
</html>

Try it

JS Bin on jsbin.com

Example 2

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$("button").click(function(){
    	$("#test").hide();
	});
});
</script>
<script type="text/javascript" language="javascript">  
 $(document).ready(function() {  
 $("p").css("background-color", "cyan");$("p").css("color", "green")  
 });  
 </script>  
 </head>  
<body>  
<p>This is my second program.</p>  
</body>  
</html>

Try it

JS Bin on jsbin.com

Please Share