Set focus on first invalid input in AngularJs form

前端 未结 13 1470
-上瘾入骨i
-上瘾入骨i 2020-12-04 18:55

I\'ve read several articles and StackOverflow questions relating to the setting of focus in AngularJs.

Unfortunately all the examples that I have read assume that th

13条回答
  •  广开言路
    2020-12-04 19:29

    You can use pure jQuery to select the first invalid input:

    $('input.ng-invalid').first().focus();

提交回复
热议问题