GENERATE QR CODE USING JAVASCRIPT

Share the post

Hello All, In the last topic, We had discussed How to convert array to object in JavaScript. Now, We will generate a QR code using JavaScript. In this tutorial, We are going to use the jquery-qrcode library to generate a QR code. Just follow the below steps to generate a QR code.

Steps to generate QR code using JavaScript

Step 1 : Include jQuery & jQuery-qrcode library as shown below

 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
 <script type="text/javascript" src="jquery.qrcode.min.js"></script>
 <script type="text/javascript" src="qrcode.js"></script>

Step 2: Write below HTML as shown below

<!DOCTYPE html>
<html>

<head>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="qrcode.js"></script>
</head>

<body>
    <div id="qrcode"></div>
</body>

<script>
    jQuery('#qrcode').qrcode("Develop mobile applications using https://developmobileapplications.com");
</script>

</html>

Write the string which you want to generate a QR code. As shown in the above example, We have generated a QR code for the string.

Step 3: Output as shown below

Generate QR code
Generate QR code

As shown in the above example, We are able to generate the QR code now.

Leave a Comment