<!DOCTYPE HTML> <html> <head> <title>Bootstrap Pincode Input examples</title> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap-pincode-input.css" rel="stylesheet"> <style> body{ } </style> <script src="https://code.jquery.com/jquery-2.1.4.min.js" type="text/javascript"></script> <script type="text/javascript" src="js/bootstrap-pincode-input.js"></script> <script> $(document).ready(function() { $('#pincode-input1').pincodeInput({hidedigits:false,complete:function(value, e, errorElement){ $("#pincode-callback").html("This is the 'complete' callback firing. Current value: " + value); // check the code if(value!="1234"){ $(errorElement).html("The code is not correct. Should be '1234'"); }else{ alert('code is correct!'); } }}); $('#pincode-input5').pincodeInput({hidedigits:true,inputs:4,placeholders:"0 0 0 1",change: function(input,value,inputnumber){ $("#pincode-callback2").html("onchange from input number "+inputnumber+", current value: " + value); }}); $('#pincode-input4').pincodeInput({hidedigits:false,inputs:4}); $('#pincode-input3').pincodeInput({hidedigits:false,inputs:5}); $('#pincode-input2').pincodeInput({hidedigits:false,inputs:6,complete:function(value, e, errorElement){ $("#pincode-callback").html("Complete callback from 6-digit test: Current value: " + value); $(errorElement).html("I'm sorry, but the code not correct"); }}); }); </script> </head> <body> <div class="container"> <h1>Bootstrap Pincode Input examples</h1> <div class="container-fluid"> <div class="row"> <div class="col-md-12"> <br/> <br/> <button onclick="javascript:location.href = 'https://github.com/fkranenburg/bootstrap-pincode-input'" class="btn-primary"> Download on Github</button> <br/> <br/> <br/> <p> This simple jQuery widget is created by Ferry Kranenburg.<br/> You need a input type text and Bootstrap.<br/> After entering a pincode the value will be updated in the original textbox.<br/> <br/> It supports a callback after all digits are entered and backspace is allowed. </p> <br/> <br/> <h4>Basic Example (normal input box)</h4> <br/> <br/> <input type="text" id="pincode-input1" > <br/> <br/> <b>Methods:</b><br/> <a href="#" onclick="javascript:$('#pincode-input1').pincodeInput().data('plugin_pincodeInput').focus()">focus</a><br/> <a href="#" onclick="javascript:$('#pincode-input1').pincodeInput().data('plugin_pincodeInput').clear()">clear</a><br/> <br/> <br/> <h4>4 hidden digits example with placeholders and onchange for every input</h4> <br/> <input type="text" id="pincode-input5" > <span id="pincode-callback2"></span> <br/> <br/> <h4>6 visible digits example</h4> <br/> <input type="text" id="pincode-input2" > complete callback: <span id="pincode-callback"></span> <br/> <br/> <h4>4 visible digits example</h4> <br/> <input type="text" id="pincode-input4" > <br/> <br/> <h4>5 visible digits example</h4> <br/> <input type="text" id="pincode-input3" > <br/> </div> </div> </div> </div> </body> </html>