Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何验证仅以+966开头的电话号码的输入?_Html - Fatal编程技术网

Html 如何验证仅以+966开头的电话号码的输入?

Html 如何验证仅以+966开头的电话号码的输入?,html,Html,我正在尝试为输入创建验证,以便用户只能输入以+966开头的数字,然后输入9个数字,如+966123456789 这是我正在使用的,但它不能满足我的需要 <input name="mobile" type="tel" pattern="^\d{13}$" required> 它给出了13个加号和12个数字,但我只需要它以+966开头注意,这并不妨碍表单以例如Safari、,还有一些浏览器不支持它。@Tomm你能帮我更改“请匹配请求的格式”消息吗?在上面的示例中,这里有“title=v

我正在尝试为输入创建验证,以便用户只能输入以+966开头的数字,然后输入9个数字,如+966123456789

这是我正在使用的,但它不能满足我的需要

<input name="mobile" type="tel" pattern="^\d{13}$" required>

它给出了13个加号和12个数字,但我只需要它以+966开头

注意,这并不妨碍表单以例如Safari、,还有一些浏览器不支持它。@Tomm你能帮我更改“请匹配请求的格式”消息吗?在上面的示例中,这里有“title=validation message”`这个标题对我不起作用,但我发现它是oninvalid=this.setCustomValidity'New message'onchange=try{setCustomValidity}catch{}@Tomm谢谢:
<input name="mobile" type="tel" pattern="^\+966\d{1,9}$" title="validation message here" required>