I have 3 input fields on my UI as in which one of them is readonly
so after entering something in my first input field when I press enter it goes directly to 3rd one which is editable
What I am trying is when I am in 3rd Input field and there I press shift+tab
I want to go back to first Input field which is editable, I have tried many things on google but not working
$(document).keypress(function(event) {
var keycode = event.keyCode || event.which;
if (keycode == '13') {
if (event.target.matches('[name=hsnCodeInput]')) {
$("#mbqInput").focus();
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<div class="row">
<div class="form-group col-xs-6 col-sm-6 col-md-6 col-lg-2">
<label for="hsnCodeInput">HSN Code</label> <input type="text" class="form-control" id="hsnCodeInput" name="hsnCodeInput">
</div>
<div class="form-group col-xs-6 col-sm-6 col-md-6 col-lg-2">
<label for="searchCodeInput">Search Code</label> <input type="text" class="form-control" id="searchCodeInput" name="searchCodeInput" readonly="readonly">
</div>
<div class="form-group col-xs-6 col-sm-6 col-md-6 col-lg-2">
<label for="mbqInput">MBQ</label> <input type="text" min="0" class="form-control" id="mbqInput" name="mbqInput">
</div>
</div>