I do not know if I understand very well what you want, but if you do not want to let the user type anything in some inputs, you can use the event itself .focus () for this.
To do this, simply add the inputs that can not be typed, and in the focus
event, redirect it to the main input.
An example would look like this:
$('.ignore').focus(function(e) {
e.preventDefault();
$('#fl1').focus();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>Principal:<inputid="fl1" />
<br/>
<br/>Ignorar:
<input class="ignore" />
<br/>Ignorar:
<input class="ignore" />
<br/>Ignorar:
<input class="ignore" />
<br/>
<br/>
<br/>Secundario:
<input id="fl2" />
In this way, all inputs with the ignore class will be directed to the input with the id fl1 .
Issue
Based on the comments, we can use the same analogy, but the reverse. We'll use document
as a selector, and if it's not the input's that you can access, focus on what you want, like this:
$(document).click(function(event) {
if (!$(event.target).closest(".ignore").length) {
$('#fl1').focus();
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>Principal:<inputid="fl1" class="ignore" />
<br/>
<br/>Ignorar:
<input />
<br/>Ignorar:
<input />
<br/>Ignorar:
<input />
<br/>
<br/>
<br/>Secundario:
<input id="fl2" class="ignore" />
For more information, you can look at this answer.