I have an odd requirement and was hoping for some help.
I need to focus on the first found invalid input of a form after clicking a button (not submit). The form is rath
@HostListener('submit', ['$event']) onSubmit(event) { event.preventDefault(); if (!this.checkoutForm.valid) { let target; target = $('input[type=text].ng-invalid').first(); if (target) { $('html,body').animate({ scrollTop: $(target).offset().top }, 'slow', ()=> { target.focus(); }); } } }