Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

61
Views
Keyup not working for PWA angular even after changing from keypress

I have a function to validate in input field / date field. When using (keypress) it is working fine on web but not in mobile. And when I am using (keyup) , the validation is not working in web as well.

What is the permanent solution for PWA Angular for this issue ?

// to validate date in numberic and / only
  keyPressAlphanumeric(event: any) {
    var inp = String.fromCharCode(event.keyCode);
    if (/[0-9_/]/.test(inp)) {
      return true;
    } else {
      event.preventDefault();
      return false;
    }
  }


<input matInput [matDatepicker]="picker"  maxlength="10" [max]="maxDate" placeholder="MM/DD/YYYY" required
                formControlName="DOI" autocomplete="off" (keypress)="keyPressAlphanumeric($event)">
7 months ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.