"maxlength reach focus on next input angular" Code Answer's
You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "maxlength reach focus on next input angular" answered properly. Developers are finding an appropriate answer about maxlength reach focus on next input angular related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like maxlength reach focus on next input angular. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on maxlength reach focus on next input angular.
maxlength reach focus on next input angular
// For angular with PureJS
//HTML
<form class="digit-group" #userForm="ngForm" (ngSubmit)="onSubmit(userForm.value)" ngNativeValidate>
<input type="text" maxlength="1" id="digit-1" name="digit-1" />
<input type="text" maxlength="1" id="digit-2" name="digit-2" />
<input type="text" maxlength="1" id="digit-3" name="digit-3" />
<!-- <span class="splitter">–</span> -->
<input type="text" maxlength="1" id="digit-4" name="digit-4" />
<input type="text" maxlength="1" id="digit-5" name="digit-5" />
<input type="text" maxlength="1" id="digit-6" name="digit-6" />
<div class="row">
<div class="col px-0 pt-4 pb-2 text-center">
<button type="button" class="btn btn-warning" (click)="dismissModal()">Close</button>
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
//Typescript
ngOnInit(): void {
var container = <HTMLInputElement>document.getElementsByClassName("digit-group")[0];
container.onkeyup = function (e) {
var target = <HTMLInputElement>e.target;
var maxLength = parseInt(target.attributes["maxlength"].value, 10);
var myLength = target.value.length;
if (myLength >= maxLength) {
var next = target;
while (next = <HTMLInputElement>next.nextElementSibling) {
if (next == null)
break;
if (next.tagName.toLowerCase() === "input") {
next.focus();
break;
}
}
}
}
}
All those coders who are working on the TypeScript based application and are stuck on maxlength reach focus on next input angular can get a collection of related answers to their query. Programmers need to enter their query on maxlength reach focus on next input angular related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about maxlength reach focus on next input angular for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of maxlength reach focus on next input angular while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "maxlength reach focus on next input angular". Visit this developer's friendly online web community, CodeProZone, and get your queries like maxlength reach focus on next input angular resolved professionally and stay updated to the latest TypeScript updates.