'I'm trying to get the value of the input to the label field in the QR generator code but not sure where I'm going wrong?
Trying to make a dynamic change along with the input that we type, there is a change in the input field . Or Once we submit the input, we get a change in the label? How can we approach it? I am trying to pass the input value but something is wrong
$(document).ready(function(){
// $(".demo").qrcode({
// text: 'https://www.jqueryscript.net'
// });
var input = document.querySelector('.input');
var data = input.value;
$(".demo").qrcode({
// 0: normal
// 1: label strip
// 2: label box
mode: 1,
label: "{{name}}",
fontname: 'sans',
fontcolor: '#000'
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://unpkg.com/browse/[email protected]/build/qrcode.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<input type="text" class="input ng-model='name'">
<div class="demo">
</div>
</body>
</html>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
