{"id":5467,"date":"2023-02-06T09:10:48","date_gmt":"2023-02-06T14:10:48","guid":{"rendered":"https:\/\/www.cloudsurph.com\/?p=5467"},"modified":"2023-02-07T09:38:06","modified_gmt":"2023-02-07T14:38:06","slug":"javascript-events-example","status":"publish","type":"post","link":"https:\/\/www.cloudsurph.com\/javascript-events-example\/","title":{"rendered":"JavaScript Events Example"},"content":{"rendered":"<h3>What is an Event?<\/h3>\n<p>In this article, we can try to show an example of a JavaScript Event function like Click Event and show how to create an event in JavaScript. JavaScript&#8217;s interaction with HTML is handled through events that occur when the user or browser navigates a page.<\/p>\n<h5><em><strong>If you want then buy a good, reliable, secure web <a href=\"https:\/\/www.cloudsurph.com\/windows-vps-hosting\/\">hosting<\/a>\u00a0service \u00a0from here:\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">click here<\/a><\/strong><\/em><\/h5>\n<p>Firstly, when the page loads, it is called an event. When the user clicks a button, that is also a click event. JavaScript has so many events like pressing any key, resizing a window, closing a window,\u00a0 etc.<\/p>\n<p>Hence, the Most Developers can use these events to execute JavaScript-coded responses, which cause buttons to close windows, data to be validated, messages to be displayed to users, and virtually any other type of response imaginable.<\/p>\n<h3>Previous JavaScript Articles<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.cloudsurph.com\/javascript-variables\/\" aria-current=\"page\">JavaScript Variables<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/javascript-operators\/\">JavaScript Operators<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/creating-an-object-in-javascript\/\">Creating an Object in JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/what-is-asynchronous-javascript\/\">Introduction to Asynchronous JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/what-is-control-flow-in-javascript\/\">Control Flow in JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.cloudsurph.com\/how-to-use-regex-in-javascript-function\/\">What is JavaScript Regex?<\/a><\/li>\n<\/ul>\n<h2>How to create an event in JavaScript<\/h2>\n<p>Secondly, The Events are a part of the Document Object Model (DOM) Level 3 and every HTML element contains a set of events that can trigger JavaScript Code.<\/p>\n<p>So, go through this small article for a better understanding of HTML Event Reference. Here we will see an example to understand the relationship between Event and JavaScript.<\/p>\n<h3><strong>What are events used for in JavaScript?<\/strong><\/h3>\n<p>Events are fired inside the browser window and are attached to a specific item in it. This might be a single element, the HTML document loaded in the current tab, a set of elements, or the entire browser window.<\/p>\n<h5><em><strong>You can purchase your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting from Cloudsurph.com<\/a>,\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">Cloudsurph hosting<\/a>\u00a0is a reliable hosting option for business and personal projects. We offer insight and help on system configuration issues and code errors or bugs<\/strong>.<\/em><\/h5>\n<p>There are many different types of we can discuss a CLICK EVENT for now.<\/p>\n<h3><strong>onclick Event Type<\/strong><\/h3>\n<p>Therefore, the most frequently used event type occurs when a user clicks the left button of his mouse and you can put your validation, warning, etc., against this event type.<\/p>\n<h2>Example<\/h2>\n<p>Try the following example:<\/p>\n<pre class=\"prettyprint\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en\"&gt;\r\n&lt;head&gt;\r\n\u00a0 \u00a0 &lt;meta charset=\"UTF-8\"&gt;\r\n\u00a0 \u00a0 &lt;meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"&gt;\r\n\u00a0 \u00a0 &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\r\n\u00a0 \u00a0 &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.2.3\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\" integrity=\"sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65\" crossorigin=\"anonymous\"&gt;\r\n\r\n\u00a0 \u00a0 &lt;title&gt;Variables and Event Example&lt;\/title&gt;\r\n\u00a0 \u00a0 &lt;style&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 img{}\r\n\u00a0 \u00a0 \u00a0 \u00a0 img:hover{cursor: pointer;}\r\n\u00a0 \u00a0 &lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\u00a0 \u00a0 &lt;header style=\"background: #f1f1f1;border-bottom:1px solid #ccc;\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"container text-center\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;h2&gt;Variables and Event Example&lt;\/h2&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 &lt;\/header&gt;\r\n\u00a0 \u00a0 &lt;section class=\"content-area\" style=\"margin: 30px auto;\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"container\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"row\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-8\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;img class=\"img-fluid\" id=\"large-image\" src=\"homework_images\/gallery-1.jpg\"\/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"row\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;img class=\"img-fluid thumbnail1\" src=\"homework_images\/gallery-2.jpg\"\/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;img class=\"img-fluid thumbnail2\" src=\"homework_images\/gallery-1.jpg\"\/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;img class=\"img-fluid thumbnail3\" src=\"homework_images\/gallery-3.jpg\"\/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;img class=\"img-fluid thumbnail4\" src=\"homework_images\/gallery-4.jpg\"\/&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;script&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let thum1=document.querySelector(\".thumbnail1\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 thum1.addEventListener(\"click\", function(){\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let src=this.getAttribute(\"src\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let largeImage=document.querySelector(\"#large-image\");\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 largeImage.setAttribute(\"src\",src);\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 })\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let thum2=document.querySelector(\".thumbnail2\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 thum2.addEventListener(\"click\", function(){\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let src=this.getAttribute(\"src\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let largeImage=document.querySelector(\"#large-image\");\r\n\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 largeImage.setAttribute(\"src\",src);\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 })\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let thum3=document.querySelector(\".thumbnail3\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 thum3.addEventListener(\"click\", function(){\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let src=this.getAttribute(\"src\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let largeImage=document.querySelector(\"#large-image\");\r\n\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 largeImage.setAttribute(\"src\",src);\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 })\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let thum4=document.querySelector(\".thumbnail4\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 thum4.addEventListener(\"click\", function(){\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let src=this.getAttribute(\"src\");\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 let largeImage=document.querySelector(\"#large-image\");\r\n\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 largeImage.setAttribute(\"src\",src);\r\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 })\r\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 &lt;\/script&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;\/div&gt;\r\n\u00a0 \u00a0 &lt;\/section&gt;\r\n\u00a0 \u00a0 &lt;footer class=\"footer\" style=\"background: #f1f1f1;border-top:1px solid #ccc;padding:15px 0px;\"&gt;\r\n\u00a0 \u00a0 \u00a0 \u00a0 &lt;div class=\"container text-center\"&gt;Copyright @ Akhtaruzzaman&lt;\/div&gt;\r\n\u00a0 \u00a0 &lt;\/footer&gt;\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h3><a href=\"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/js_event.zip\">ClICK HERE FOR DOWNLOAD THE FILE >><\/a><\/h3>\n<p>That\u2019s it. If you enjoyed reading this article and have more questions please reach out to our\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/submitticket.php?step=2&amp;deptid=1\">support team<\/a>\u00a0via live chat or\u00a0<a href=\"mailto:support@cloudsurph.com\">email<\/a>\u00a0and we would be glad to help you. we provide server\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">hosting<\/a>\u00a0for all types of need and we can even get your\u00a0<a href=\"https:\/\/hosting.cloudsurph.com\/\">server<\/a>\u00a0up and running with the service of your choice.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is an Event? In this article, we can try to show an example of a JavaScript Event function like Click Event and show how to create an event in JavaScript. JavaScript&#8217;s interaction with HTML is handled through events that occur when the user or browser navigates a page. If you want then buy a [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":5468,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[157,25,162,159,44,1],"tags":[54,47,105,103,48,113],"class_list":["post-5467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7","category-web-hosting-virtualization","category-javascript","category-linux-server","category-kvm-xen","category-virtual-private-servers","tag-best-vps-hosting-server-maryland","tag-cheap-cloud-servers","tag-cheap-storage-server-hosting","tag-cheapest-vps","tag-dedicated-server-hosting-in-washington-d-c","tag-speed-test-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to create an event in JavaScript?<\/title>\n<meta name=\"description\" content=\"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.cloudsurph.com\/javascript-events-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to create an event in JavaScript?\" \/>\n<meta property=\"og:description\" content=\"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.cloudsurph.com\/javascript-events-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudsurph Web Hosting Washington D.C.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/CloudSurph\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-06T14:10:48+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-07T14:38:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1264\" \/>\n\t<meta property=\"og:image:height\" content=\"760\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Rony\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@cloudsurph\" \/>\n<meta name=\"twitter:site\" content=\"@Cloud_Surph\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rony\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/\"},\"author\":{\"name\":\"Rony\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\"},\"headline\":\"JavaScript Events Example\",\"datePublished\":\"2023-02-06T14:10:48+00:00\",\"dateModified\":\"2023-02-07T14:38:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/\"},\"wordCount\":426,\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/How-to-create-an-event-in-JavaScript.jpg\",\"keywords\":[\"Best VPS hosting server Maryland\",\"Cheap Cloud Servers\",\"Cheap Storage Server Hosting\",\"Cheapest VPS\",\"Dedicated Server Hosting in Washington D.C\",\"Speed test VPS\"],\"articleSection\":[\"CentOS 7\",\"Cloud Hosting\",\"JavaScript\",\"Linux Server\",\"Virtualization\",\"VPS Servers\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/\",\"name\":\"How to create an event in JavaScript?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/How-to-create-an-event-in-JavaScript.jpg\",\"datePublished\":\"2023-02-06T14:10:48+00:00\",\"dateModified\":\"2023-02-07T14:38:06+00:00\",\"description\":\"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/How-to-create-an-event-in-JavaScript.jpg\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2023\\\/02\\\/How-to-create-an-event-in-JavaScript.jpg\",\"width\":1264,\"height\":760,\"caption\":\"JavaScript Events with Examples\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/javascript-events-example\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.cloudsurph.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript Events Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#website\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"name\":\"Cloudsurph Web Hosting Washington D.C.\",\"description\":\"Dedicated Server Hosting\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.cloudsurph.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#organization\",\"name\":\"CloudSurph Technology Solutions\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.cloudsurph.com\\\/wp-content\\\/uploads\\\/2016\\\/04\\\/cloudsurph-logo.png\",\"width\":2348,\"height\":1692,\"caption\":\"CloudSurph Technology Solutions\"},\"image\":{\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/CloudSurph\\\/\",\"https:\\\/\\\/x.com\\\/Cloud_Surph\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.cloudsurph.com\\\/#\\\/schema\\\/person\\\/ac9b4dd136d96e50d5f29c560191e7ed\",\"name\":\"Rony\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g\",\"caption\":\"Rony\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/cloudsurph\"],\"url\":\"https:\\\/\\\/www.cloudsurph.com\\\/author\\\/ron\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to create an event in JavaScript?","description":"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.cloudsurph.com\/javascript-events-example\/","og_locale":"en_US","og_type":"article","og_title":"How to create an event in JavaScript?","og_description":"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript","og_url":"https:\/\/www.cloudsurph.com\/javascript-events-example\/","og_site_name":"Cloudsurph Web Hosting Washington D.C.","article_publisher":"https:\/\/www.facebook.com\/CloudSurph\/","article_published_time":"2023-02-06T14:10:48+00:00","article_modified_time":"2023-02-07T14:38:06+00:00","og_image":[{"width":1264,"height":760,"url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg","type":"image\/jpeg"}],"author":"Rony","twitter_card":"summary_large_image","twitter_creator":"@cloudsurph","twitter_site":"@Cloud_Surph","twitter_misc":{"Written by":"Rony","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#article","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/"},"author":{"name":"Rony","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed"},"headline":"JavaScript Events Example","datePublished":"2023-02-06T14:10:48+00:00","dateModified":"2023-02-07T14:38:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/"},"wordCount":426,"publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"image":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg","keywords":["Best VPS hosting server Maryland","Cheap Cloud Servers","Cheap Storage Server Hosting","Cheapest VPS","Dedicated Server Hosting in Washington D.C","Speed test VPS"],"articleSection":["CentOS 7","Cloud Hosting","JavaScript","Linux Server","Virtualization","VPS Servers"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/","url":"https:\/\/www.cloudsurph.com\/javascript-events-example\/","name":"How to create an event in JavaScript?","isPartOf":{"@id":"https:\/\/www.cloudsurph.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#primaryimage"},"image":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg","datePublished":"2023-02-06T14:10:48+00:00","dateModified":"2023-02-07T14:38:06+00:00","description":"JavaScript events example, How to create an event in JavaScript, What are events write one example, What are events used for in JavaScript","breadcrumb":{"@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.cloudsurph.com\/javascript-events-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#primaryimage","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2023\/02\/How-to-create-an-event-in-JavaScript.jpg","width":1264,"height":760,"caption":"JavaScript Events with Examples"},{"@type":"BreadcrumbList","@id":"https:\/\/www.cloudsurph.com\/javascript-events-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.cloudsurph.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript Events Example"}]},{"@type":"WebSite","@id":"https:\/\/www.cloudsurph.com\/#website","url":"https:\/\/www.cloudsurph.com\/","name":"Cloudsurph Web Hosting Washington D.C.","description":"Dedicated Server Hosting","publisher":{"@id":"https:\/\/www.cloudsurph.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.cloudsurph.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.cloudsurph.com\/#organization","name":"CloudSurph Technology Solutions","url":"https:\/\/www.cloudsurph.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","contentUrl":"https:\/\/www.cloudsurph.com\/wp-content\/uploads\/2016\/04\/cloudsurph-logo.png","width":2348,"height":1692,"caption":"CloudSurph Technology Solutions"},"image":{"@id":"https:\/\/www.cloudsurph.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/CloudSurph\/","https:\/\/x.com\/Cloud_Surph"]},{"@type":"Person","@id":"https:\/\/www.cloudsurph.com\/#\/schema\/person\/ac9b4dd136d96e50d5f29c560191e7ed","name":"Rony","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/40163fe1eb49d5eddd81954e8ad5122633e141df15b0733d07fbe4a156688ba5?s=96&d=mm&r=g","caption":"Rony"},"sameAs":["https:\/\/x.com\/cloudsurph"],"url":"https:\/\/www.cloudsurph.com\/author\/ron\/"}]}},"_links":{"self":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/comments?post=5467"}],"version-history":[{"count":5,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5467\/revisions"}],"predecessor-version":[{"id":5474,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/posts\/5467\/revisions\/5474"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media\/5468"}],"wp:attachment":[{"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/media?parent=5467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/categories?post=5467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudsurph.com\/wp-json\/wp\/v2\/tags?post=5467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}