Validate form field after user leaves the field

Discussão em 'Angular' iniciado por Mr.X, Novembro 22, 2024.

  1. Mr.X

    Mr.X Guest

    I want to validate a form field after user has left the field. I wrote my html as below

    <input type="text" onfocusout="validateIp()"formControlName="ip_address" (input)="onIpChange($event.target.value)" pattern="^[a-zA-Z0-9.]*$"class="form-control form-control-sm" id="IP_Address">


    Below is my typescript code

    validateIp(){

    console.log('validateIp is called');
    }


    onfocusout is not working as expected . Below is error I am getting

    Uncaught ReferenceError: validateIp is not defined
    at HTMLInputElement.onfocusout


    I have tried onblur also but event is not getting triggered

    Continue reading...

Compartilhe esta Página