โค้ดแปลงข้อความเป็น qrcode bootstrap
โค้ดแปลงข้อความเป็น qrcode bootstrap
ถ้าคุณต้องการให้ผู้ใช้กรอกข้อความแล้วแปลงเป็น QR code โดย Bootstrap คุณสามารถเพิ่ม textbox เข้าไปในโค้ด HTML ได้ดังนี้:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QR Code Bootstrap</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3 mt-5">
<input type="text" class="form-control mb-3" id="inputText" placeholder="Enter text">
<div id="qrcode"></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs/qrcode.min.js"></script>
<script>
$(document).ready(function(){
$("#inputText").on("input", function() {
var qrText = $(this).val();
var qrcode = new QRCode(document.getElementById("qrcode"), {
width : 200,
height : 200
});
qrcode.makeCode(qrText);
});
});
</script>
</body>
</html>
- ดูระบบ PHP ทั้งหมด
- อ่านบทความทั้งหมด
- ติดต่อเรา
รับเขียนเว็บไซต์ รับเขียนโปรแกรม ระบบต่างๆ SEO
Line : rayongall / โทร. 085-281-7096
