I have a regex pattern for a telephone number field which allows the user to enter either 10 numbers or 0. I have tested it and confirmed it is working in Google Chrome, Internet Explorer, Firefox, Opera and safari but for some reason it is not working in Netscape Navigator 9. Any help is very much appreciated.
Thank you
pattern="^[0-9]{10}$|^[0-9]{0}$"
The new trend is to not detect specific browsers, but rather support for the feature you need; in this case "pattern".
var el = document.createElement('input');
var isPatternSupported = (el.pattern === undefined);
alert(isPatternSupported); // Displays `false` for NN9 and `true` for modern browsers
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.