Look at the image:
I want design something like in the image, where a 4 digit one time password (OTP) is to be entered by user. Right now I have achieved th
I don't know how to split an input in html5, maybe in css you can use the same class to controll your input and you can style input, something like :
div{
text-align:center;
background:#eee;
}
input{
border: 0;
outline: 0;
background: transparent;
border-bottom: 2px solid black;
width: 100px;
text-align:center;
padding : 5px;
margin-left:10px;
}
button{
margin-top:20px !important;
margin: 0 auto;
color: white;
border-radius: 4px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
<div>
<input class="form-control" placeholder="0" maxlength="1" />
<input class="form-control" placeholder="0" maxlength="1" />
<input class="form-control" placeholder="0" maxlength="1" />
<input class="form-control" placeholder="0" maxlength="1" />
<br><button type="button" onclick="myFunction()">Submit</button>
<p id="optRes"></p>
</div>
Define myFunction() and You can get your array by your class : form-control, convert to string then into int if you have to check it . Helps this ?