Let me explain you with a suitable example:-
dblclick.html:-
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/dbclick.js"></script>
</head>
<body>
<p id="p1">Double-Click on this paragraph to hide it</p>
</body>
</html>
dblclick.html:-
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
<script src="js/dbclick.js"></script>
</head>
<body>
<p id="p1">Double-Click on this paragraph to hide it</p>
</body>
</html>
dblclick.js:-
$(document).ready(function(){
$("p").dblclick(function(){
$("#p1").hide();
});
});
Screenshot:-
Explanation:-
When we will double-click the paragraph defined in the page, that paragraph will get hidden. Here, an "id" attribute has been added along with the "p" tag/element, whose value has been called in the jquey function.
No comments:
Post a Comment