Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.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
Javascript 电话号码输入-电流已满时,关注下一次输入_Javascript_Jquery_Html_Forms - Fatal编程技术网

Javascript 电话号码输入-电流已满时,关注下一次输入

Javascript 电话号码输入-电流已满时,关注下一次输入,javascript,jquery,html,forms,Javascript,Jquery,Html,Forms,我想为一个电话号码做一组3个表单输入,当第一组数字满时,它会自动关注下一组数字 我的表单是以下HTML字符串: myLayer.eachLayer(function(layer) { // here you call `bindPopup` with a string of HTML you create - the feature // properties declared above are available under `layer.feature.propert

我想为一个电话号码做一组3个表单输入,当第一组数字满时,它会自动关注下一组数字

我的表单是以下HTML字符串:

myLayer.eachLayer(function(layer) {

     // here you call `bindPopup` with a string of HTML you create - the feature
     // properties declared above are available under `layer.feature.properties`

var content = '<div class="tooltip-header">Store Name<\/div>' +
              '<div class="tooltip-address">' + layer.feature.properties.address1 + '<div\/>' +
              '<div class="tooltip-address">' + layer.feature.properties.address2 + '<div\/>' +
              '<br>'+
              '<div class="tooltip-phoneLabel">' + layer.feature.properties.phoneLabel + '<div\/>'+
              '<br>'+
              '<div class="phone-input">'+
              '<input class="phone-input" name="phone-input" type="tel" size="3" maxlength="3" placeholder="555">  '+
              '<input class="phone-input" name="phone-input" type="tel" size="3" maxlength="3" placeholder="555">  '+
              '<input class="phone-input" name="phone-input" type="tel" size="4" maxlength="4" placeholder="5555">'+
              '<\/div>';

     layer.bindPopup(content);
});
myLayer.eachLayer(函数(层){
//在这里,您使用创建的HTML字符串调用'bindpoppopup',这是一个特性
//上面声明的属性在“layer.feature.properties”下可用`
var content='Store Name'+
''+layer.feature.properties.address1+''+
''+layer.feature.properties.address2+''+
“
”+ ''+layer.feature.properties.phoneLabel+''层+ “
”+ ''+ ' '+ ' '+ ''+ ''; 层绑定弹出窗口(内容); });
使用以下示例实现您想要的:

$(document).ready(function(){

    $('body').on('keyup', 'input.phone-input', function(){
        if($(this).val().length === this.size){
            var inputs = $('input.phone-input');
            inputs.eq(inputs.index(this) + 1).focus();
        }
    });

});

$(document).ready(function(){HERE})中的任意位置。再次看到我的答案,我做了一点修改;)只是一些建议和类似的解决方案(在过去做过类似的事情):扩展呢?例1-800-123-1234 x 78923?几乎所有的业务都将有扩展。那么采用不同格式的外国电话号码呢?如果外国电话号码采用类似的格式,但需要+国家代码,该怎么办?世界上最糟糕的事情就是因为你的联系方式的技术限制而失去一个潜在客户…我很感激@dman2306的输入这是一个为美国商店注册文本通知的表格,所以我想我们会没事的。