Q:

Attach a click and double-click event to the <p> element using jquery

0

Attach a click and double-click event to the <p> element using jquery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<meta charset="utf-8">
<title>Attach a click and double-click event to the <p> element</title>
</head>
<body>
<p>Click me!</p>
<div id="result"></div>
</body>

JavaScript Code :

$("p").bind("click", function(){
   $( "<p>This is a click Event</p>").appendTo( "#result" );
   });
   $("p").bind("dblclick", function(){
     $( "<p>This is a double-click Event</p>"  ).appendTo( "#result" );
	 });

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now