user3545266
user3545266

Reputation: 79

how can I implement a qr code in HTML?

I used

<script type="text/javascript" src="qrcode.min.js"></script>

and

var qrcode = new QRCode("test", {
  text: "http://jindo.dev.naver.com/collie",
  width: 128,
  height: 128,
  colorDark : "#000000",
  colorLight : "#ffffff",
  correctLevel : QRCode.CorrectLevel.H
});

but it didn't work out for me.. did I include it false or something?

Upvotes: -1

Views: 7008

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167220

You need to do this way. Have a <div> that will have QR Code:

<div id="test"></div>

Then initialize this way:

<script type="text/javascript">
    new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
</script>

In your script, it should be:

var qrcode = new QRCode(document.getElementById("test"), {
  text: "http://jindo.dev.naver.com/collie",
  width: 128,
  height: 128,
  colorDark : "#000000",
  colorLight : "#ffffff",
  correctLevel : QRCode.CorrectLevel.H
});

Upvotes: 2

Related Questions