Hey there, I've put together a simple program using AngularJS that demonstrates how to focus on a specific field when an error occurs. Thanks in advance for checking it out!
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.save=function(){
if($scope.firstName != undefined){
if($scope.firstName.length < 3) {
alert("Please Enter More than 3 characters");
}
}
}
})
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myApp" ng-controller="myCtrl">
<form>
<input type="text" ng-model="firstName"/>
<input type="submit" ng-click="save()"/>
</form>