I have some sort of form, which prevent to fill the second input text before filling the first input, here is my code
function autotab(current,to){
if (current.getAttribute &&
current.value.length==current.getAttribute("maxlength")) {
//to.removeAttr('readonly');
to.focus();
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="answers">
<input type="text" id="i1" name="i1" size=1 onKeyup="autotab(this, i2)" maxlength=1 autofocus><br>
<input type="text" id="i2" name="i2" size=1 onKeyup="autotab(this, i3)" maxlength=1 readonly><br>
<input type="text" id="i3" name="i3" size=1 onKeyup="autotab(this, i4)" maxlength=1 readonly><br>
what I really want is to remove readonly
attribute, I'm using the to.removeAttr('readonly')
but it show error Uncaught TypeError: to.removeAttr is not a function
I already tried to use to.prop('readonly', false);
but it doesn't change anything, any advice?