Hello, I want to make an input that can’t be submitted if it doesn’t contain ‘+’ sign before all of content.
I want it for phone numbers.
For example,
+994551112233 - TRUE
994+551112233 - FALSE
Hello, I want to make an input that can’t be submitted if it doesn’t contain ‘+’ sign before all of content.
I want it for phone numbers.
For example,
+994551112233 - TRUE
994+551112233 - FALSE
I couldn’t do this with pattern
You’ll want to use reg exp for that.
There is no plus sign checker
What code are you using right now? As you can definitely do it using JavaScript and Regex (might be able to using HTML 5 input pattern attribute
Something like
<input type="tel" pattern="\+[0-9]{12}" />
Thank You
Hi there heybetov1998,
don’t forget to also add the “required attribute”
coothead
If you are looking for pre-made regex patterns for phone numbers (or other things) there are a few on this site:-
http://html5pattern.com/Phones
If you want to experiment and create you own custom regex patterns, I find this tool quite useful:-
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.