简体   繁体   中英

Javascipt not working in Samsung Internet Browser

I am working in angular project have below function

isNumber(evt) {
    evt = (evt) ? evt : window.event;
    let charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
      return false;
    }
    return true;
  }

and in HTML

<input type="text" class="form-control" id="abc" name="abc"
            formControlName="abc" maxlength="4" pattern="\d[0-9]+"(keypress)="isNumber($event)"/>

It works on all browsers except in the Samsung internet browser in Android phones. It still accepting alphabets which I do not want. Please help me with this. Thanks in advance

"If you're having trouble accessing webpages or getting errors about Javascript on your mobile device or tablet, see the steps below on how to enable Javascript in Samsung Internet Browser..."

Have you tried to turn on JavaScript like Samsung explains it: https://www.samsung.com/au/support/mobile-devices/how-do-i-turn-on-javascript/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM