This javascript plugin helps to render otp input for any project. Click here for demo
- import
.css
and.js
file inside the html page.
<link rel="stylesheet" href="quickotp.css">
<script src="quickotp.js"></script>
- Add container where you need to render the OTP input box in your body html.
<div id="otp-holder"></div>
- Now initialise the QuickOTP library followed after importing
quickotp.js
with config and render.
<script>
let qinstance = new QuickOTP("#otp-holder", {
otpLength : 6,
boxSize : "50px",
boxColor : "#d35400",
fontSize : "27px"
}).render();
</script>
- To get the otp code entered by user. Call the instance method.
getOtp()
<script>
qinstance.getOtp();
</script>
Thanks. That's all guys for now.