我不知道大胆的部分是什么意思:
<input name="zip_code" type="text" pattern="\d{5}(-\d{4})?" required="required" />
任何人都可以帮助我吗?
答案 0 :(得分:0)
(-\d{4})?
表示需要5位数字
pattern="\d{5}(-\d{4})?"
表示角色&#34; - &#34;和其他4个数字是可选的
答案 1 :(得分:0)
48412 - Accepted
4488 - Rejected
44775-4412 - Accepted
74547-45745 - Rejected
平均值
示例
^ a string that starts with...
( either
\d a digit (0-9)...
{4} that repeats four times...
| or
\d a digit (0-9)...
{6} that repeats six times...
)
$ and then ends
规则如下
function initMap() {
var autoInputs = [];
// Destroy all existing inputs and reload them.
function autoAllInputs() {
autoInputs = [];
$.each($(".js-location-input"), function( i, input ) {
var ainput = new google.maps.places.Autocomplete(input);
ainput.setComponentRestrictions({'country': countryCodes});
autoInputs.push(ainput);
});
}
var $template = $(".js-repeat-template");
var $container = $(".js-repeated-items");
$(".js-add-repeatable").on("click", function(e) {
e.preventDefault();
$container.append($template.html());
autoAllInputs();
});
autoAllInputs();