Search
 
SCRIPT & CODE EXAMPLE
 

HTML

html qr code generator

<html>
    <head>
        <title>Testing QR code</title>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
        <script type="text/javascript">
            function generateBarCode()
            {
                var nric = $('#text').val();
                var url = 'https://api.qrserver.com/v1/create-qr-code/?data=' + nric + '&amp;size=50x50';
                $('#barcode').attr('src', url);
            }
        </script>
    </head>
    <body>
        <input id="text" type="text" 
            value="NRIC or Work Permit" style="Width:20%"
            onblur='generateBarCode();' /> 

      <img id='barcode' 
            src="https://api.qrserver.com/v1/create-qr-code/?data=HelloWorld&amp;size=100x100" 
            alt="" 
            title="HELLO" 
            width="50" 
            height="50" />
    </body>
</html>
Comment

qr code in html

<!DOCTYPE html>
<html>
  
<head>
  <!-- Include Bootstrap for styling -->
  <link rel="stylesheet" href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
  
  <style>
    .qr-code {
      max-width: 200px;
      margin: 10px;
    }
  </style>
  
  <title>QR Code Generator</title>
</head>
  
<body>
  <div class="container-fluid">
    <div class="text-center">
  
      <!-- Get a Placeholder image initially,
       this will change according to the
       data entered later -->
      <img src=
"https://chart.googleapis.com/chart?cht=qr&chl=Hello+World&chs=160x160&chld=L|0"
        class="qr-code img-thumbnail img-responsive" />
    </div>
  
    <div class="form-horizontal">
      <div class="form-group">
        <label class="control-label col-sm-2"
          for="content">
          Content:
        </label>
        <div class="col-sm-10">
  
          <!-- Input box to enter the 
              required data -->
          <input type="text" size="60" 
            maxlength="60" class="form-control"
            id="content" placeholder="Enter content" />
        </div>
      </div>
      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
  
          <!-- Button to generate QR Code for
           the entered data -->
          <button type="button" class=
            "btn btn-default" id="generate">
            Generate
          </button>
        </div>
      </div>
    </div>
  </div>
  <script src=
    "https://code.jquery.com/jquery-3.5.1.js">
  </script>
  
  <script>
    // Function to HTML encode the text
    // This creates a new hidden element,
    // inserts the given text into it 
    // and outputs it out as HTML
    function htmlEncode(value) {
      return $('<div/>').text(value)
        .html();
    }
  
    $(function () {
  
      // Specify an onclick function
      // for the generate button
      $('#generate').click(function () {
  
        // Generate the link that would be
        // used to generate the QR Code
        // with the given data 
        let finalURL =
'https://codingforfree.com/' +
          htmlEncode($('#content').val()) +
          '&chs=160x160&chld=L|0'
  
        // Replace the src of the image with
        // the QR code image
        $('.qr-code').attr('src', finalURL);
      });
    });
  </script>
</body>
  
</html>
Comment

PREVIOUS NEXT
Code Example
Html :: select placeholder 
Html :: add favorite icon to website html 
Html :: execute python script onclick html 
Html :: markdown table cell multiple lines 
Html :: text bold in .md file 
Html :: checkbox switch bootstrap 
Html :: content editable 
Html :: how to refer to external style sheet 
Html :: dropdown content left 
Html :: img html 
Html :: flutter build web with html render 
Html :: input type button 
Html :: pgadmin erd tool existing database 
Html :: how to use the label tag in html 
Html :: cool css buton 
Html :: hide first option in select 
Html :: vs code view release notes 
Html :: html quotation 
Html :: on button click video popup in html 
Html :: html if screen is smaller thatn 
Html :: html paragraph 
Html :: android strings plural 
Html :: bootstrap switch change text 
Html :: oauth vs auth0 
Html :: html5 datalist 
Html :: prevent modal from auto closing when clicked away 
Html :: unselectable input field 
Html :: view html file linux terminal 
Html :: title tag html 
Html :: delete html 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =