JavaScript dblclick eventThe dblclick event generates an event on double click the element. The event fires when an element is clicked twice in a very short span of time. We can also use the JavaScript's addEventListener() method to fire the double click event. In HTML, we can use the ondblclick attribute to create a double click event. SyntaxNow, we see the syntax of creating double click event in HTML and in javascript (without using addEventListener() method or by using the addEventListener() method). In HTMLIn JavaScriptIn JavaScript by using the addEventListener() methodLet's see some of the illustrations to understand the double click event. Example - Using ondblclick attribute in HTMLIn this example, we are creating the double click event using the HTML ondblclick attribute. Test it NowOutput After the execution of the above code, the output will be - ![]() After double-clicking the text "Hello world", the output will be - ![]() Now, we will see how to create double click event using JavaScript. Example - Using JavaScriptTest it NowOutput ![]() After double-clicking the text "Hello world", the output will be - ![]() Example - Using JavaScript's addEventListener() methodTest it NowOutput ![]() After double-clicking the text "Hello world", the output will be - ![]()
Next TopicJavaScript onload
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week