{"id":3677,"date":"2022-10-08T12:23:15","date_gmt":"2022-10-08T07:23:15","guid":{"rendered":"https:\/\/www.edopedia.com\/blog\/?p=3677"},"modified":"2022-10-08T12:23:17","modified_gmt":"2022-10-08T07:23:17","slug":"how-to-make-qr-code-generator-using-html5-css3-javascript","status":"publish","type":"post","link":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/","title":{"rendered":"How to Make QR Code Generator using HTML5, CSS3 &#038; JavaScript"},"content":{"rendered":"\n<p>In this tutorial, I will teach you\u00a0<strong>how to create a QR Code Generator<\/strong>\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR Code Generator script is given below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">JavaScript QR Code Generator Source Code<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">index.html<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;htmlmixed&quot;,&quot;mime&quot;:&quot;text\/html&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;HTML&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;html&quot;}\">&lt;!DOCTYPE html&gt;\n&lt;html lang=&quot;en&quot; dir=&quot;ltr&quot;&gt;\n  &lt;head&gt;\n    &lt;meta charset=&quot;utf-8&quot;&gt;  \n    &lt;title&gt;QR Code Generator&lt;\/title&gt;\n    &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;\n    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;div class=&quot;wrapper&quot;&gt;\n      &lt;header&gt;\n        &lt;h1&gt;QR Code Generator&lt;\/h1&gt;\n        &lt;p&gt;Paste a url or enter text to create QR code&lt;\/p&gt;\n      &lt;\/header&gt;\n      &lt;div class=&quot;form&quot;&gt;\n        &lt;input type=&quot;text&quot; spellcheck=&quot;false&quot; placeholder=&quot;Enter text or url&quot;&gt;\n        &lt;button&gt;Generate QR Code&lt;\/button&gt;\n      &lt;\/div&gt;\n      &lt;div class=&quot;qr-code&quot;&gt;\n        &lt;img src=&quot;&quot; alt=&quot;qr-code&quot;&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n\n    &lt;script src=&quot;script.js&quot;&gt;&lt;\/script&gt;\n\n  &lt;\/body&gt;\n&lt;\/html&gt;<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">script.js<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;javascript&quot;,&quot;mime&quot;:&quot;text\/javascript&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;JavaScript&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;js&quot;}\">const wrapper = document.querySelector(&quot;.wrapper&quot;),\nqrInput = wrapper.querySelector(&quot;.form input&quot;),\ngenerateBtn = wrapper.querySelector(&quot;.form button&quot;),\nqrImg = wrapper.querySelector(&quot;.qr-code img&quot;);\nlet preValue;\n\ngenerateBtn.addEventListener(&quot;click&quot;, () =&gt; {\n    let qrValue = qrInput.value.trim();\n    if(!qrValue || preValue === qrValue) return;\n    preValue = qrValue;\n    generateBtn.innerText = &quot;Generating QR Code...&quot;;\n    qrImg.src = `https:\/\/api.qrserver.com\/v1\/create-qr-code\/?size=200x200&amp;data=${qrValue}`;\n    qrImg.addEventListener(&quot;load&quot;, () =&gt; {\n        wrapper.classList.add(&quot;active&quot;);\n        generateBtn.innerText = &quot;Generate QR Code&quot;;\n    });\n});\n\nqrInput.addEventListener(&quot;keyup&quot;, () =&gt; {\n    if(!qrInput.value.trim()) {\n        wrapper.classList.remove(&quot;active&quot;);\n        preValue = &quot;&quot;;\n    }\n});<\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">style.css<\/h3>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;css&quot;,&quot;mime&quot;:&quot;text\/css&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;CSS&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;css&quot;}\">\/* Import Google Font - Poppins *\/\n@import url('https:\/\/fonts.googleapis.com\/css2?family=Poppins:wght@400;500;600;700&amp;display=swap');\n*{\n  margin: 0;\n  padding: 0;\n  box-sizing: border-box;\n  font-family: 'Poppins', sans-serif;\n}\nbody{\n  display: flex;\n  padding: 0 10px;\n  min-height: 100vh;\n  align-items: center;\n  background: #3498DB;\n  justify-content: center;\n}\n::selection{\n  color: #fff;\n  background: #3498DB;\n}\n.wrapper{\n  height: 265px;\n  max-width: 410px;\n  background: #fff;\n  border-radius: 7px;\n  padding: 20px 25px 0;\n  transition: height 0.2s ease;\n  box-shadow: 0 10px 30px rgba(0,0,0,0.1);\n}\n.wrapper.active{\n  height: 530px;\n}\nheader h1{\n  font-size: 21px;\n  font-weight: 500;\n}\nheader p{\n  margin-top: 5px;\n  color: #575757;\n  font-size: 16px;\n}\n.wrapper .form{\n  margin: 20px 0 25px;\n}\n.form :where(input, button){\n  width: 100%;\n  height: 55px;\n  border: none;\n  outline: none;\n  border-radius: 5px;\n  transition: 0.1s ease;\n}\n.form input{\n  font-size: 18px;\n  padding: 0 17px;\n  border: 1px solid #999;\n}\n.form input:focus{\n  box-shadow: 0 3px 6px rgba(0,0,0,0.13);\n}\n.form input::placeholder{\n  color: #999;\n}\n.form button{\n  color: #fff;\n  cursor: pointer;\n  margin-top: 20px;\n  font-size: 17px;\n  background: #3498DB;\n}\n.qr-code{\n  opacity: 0;\n  display: flex;\n  padding: 33px 0;\n  border-radius: 5px;\n  align-items: center;\n  pointer-events: none;\n  justify-content: center;\n  border: 1px solid #ccc;\n}\n.wrapper.active .qr-code{\n  opacity: 1;\n  pointer-events: auto;\n  transition: opacity 0.5s 0.05s ease;\n}\n.qr-code img{\n  width: 170px;\n}\n\n@media (max-width: 430px){\n  .wrapper{\n    height: 255px;\n    padding: 16px 20px;\n  }\n  .wrapper.active{\n    height: 510px;\n  }\n  header p{\n    color: #696969;\n  }\n  .form :where(input, button){\n    height: 52px;\n  }\n  .qr-code img{\n    width: 160px;\n  }  \n}<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR Code Generator script is given below. JavaScript QR Code Generator Source Code index.html script.js style.css<\/p>\n","protected":false},"author":1,"featured_media":3679,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-3677","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Make QR Code Generator using HTML5, CSS3 &amp; JavaScript<\/title>\n<meta name=\"description\" content=\"In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR\" \/>\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.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Make QR Code Generator using HTML5, CSS3 &amp; JavaScript\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/\" \/>\n<meta property=\"og:site_name\" content=\"Edopedia\" \/>\n<meta property=\"article:author\" content=\"trulyfurqan\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-08T07:23:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-08T07:23:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"880\" \/>\n\t<meta property=\"og:image:height\" content=\"495\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Furqan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Furqan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Make QR Code Generator using HTML5, CSS3 & JavaScript","description":"In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR","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.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/","og_locale":"en_US","og_type":"article","og_title":"How to Make QR Code Generator using HTML5, CSS3 & JavaScript","og_description":"In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR","og_url":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/","og_site_name":"Edopedia","article_author":"trulyfurqan","article_published_time":"2022-10-08T07:23:15+00:00","article_modified_time":"2022-10-08T07:23:17+00:00","og_image":[{"width":880,"height":495,"url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg","type":"image\/jpeg"}],"author":"Furqan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Furqan","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#article","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/"},"author":{"name":"Furqan","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339"},"headline":"How to Make QR Code Generator using HTML5, CSS3 &#038; JavaScript","datePublished":"2022-10-08T07:23:15+00:00","dateModified":"2022-10-08T07:23:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/"},"wordCount":55,"commentCount":0,"publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg","articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/","url":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/","name":"How to Make QR Code Generator using HTML5, CSS3 & JavaScript","isPartOf":{"@id":"https:\/\/www.edopedia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#primaryimage"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#primaryimage"},"thumbnailUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg","datePublished":"2022-10-08T07:23:15+00:00","dateModified":"2022-10-08T07:23:17+00:00","description":"In this tutorial, I will teach you\u00a0how to create a QR Code Generator\u00a0using HTML5, CSS3, and JavaScript. The complete source code of this JavaScript QR","breadcrumb":{"@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#primaryimage","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2022\/10\/QR-Code-Generator-in-HTML-CSS-JavaScript.jpg","width":880,"height":495,"caption":"How to Make QR Code Generator using HTML5, CSS3 & JavaScript"},{"@type":"BreadcrumbList","@id":"https:\/\/www.edopedia.com\/blog\/how-to-make-qr-code-generator-using-html5-css3-javascript\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.edopedia.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Make QR Code Generator using HTML5, CSS3 &#038; JavaScript"}]},{"@type":"WebSite","@id":"https:\/\/www.edopedia.com\/blog\/#website","url":"https:\/\/www.edopedia.com\/blog\/","name":"Edopedia","description":"Coding\/Programming Blog","publisher":{"@id":"https:\/\/www.edopedia.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.edopedia.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.edopedia.com\/blog\/#organization","name":"Edopedia","url":"https:\/\/www.edopedia.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","contentUrl":"https:\/\/www.edopedia.com\/blog\/wp-content\/uploads\/2017\/10\/edopedia_icon_text_10.jpg","width":400,"height":100,"caption":"Edopedia"},"image":{"@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/3951cb19e3aa56df09e408c98aa02339","name":"Furqan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.edopedia.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e5e68aef3ad8f0b83d56f4953c512c8e57bd2e6dc64daec33b5d0495d9058f51?s=96&d=mm&r=g","caption":"Furqan"},"description":"Well. I've been working for the past three years as a web designer and developer. I have successfully created websites for small to medium sized companies as part of my freelance career. During that time I've also completed my bachelor's in Information Technology.","sameAs":["http:\/\/www.edopedia.com\/blog\/","trulyfurqan"],"url":"https:\/\/www.edopedia.com\/blog\/author\/furqan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/comments?post=3677"}],"version-history":[{"count":1,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3677\/revisions"}],"predecessor-version":[{"id":3678,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/posts\/3677\/revisions\/3678"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media\/3679"}],"wp:attachment":[{"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/media?parent=3677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/categories?post=3677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edopedia.com\/blog\/wp-json\/wp\/v2\/tags?post=3677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}