Reputation: 13
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}$"
Upvotes: 0
Views: 125
Reputation: 13912
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
Upvotes: 0