Jquery中的索引问题。 [英] Index Problem in Jquery.

查看:63
本文介绍了Jquery中的索引问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,



例如:'9869472979','9932145698'

在第一个手机号码中,索引0和1有值9和8

在第二个手机号码中,索引0和1的值为9和9

因此,如果索引o和1的值为9和8,则显示否则为' t显示该号码。



我的代码如下:

Hello Team,

for example : '9869472979','9932145698'
In first mobile number, index 0 and 1 have value 9 and 8
In Second Mobile Number, index 0 and 1 have value 9 and 9
So If index o and 1 have value 9 and 8 then show otherwise don't show that number .

I have the Code as follow:

var obj = ['9869472979', '9930229947', '022-22556212'];
            $.each(obj, function (i, val) {
                if (val.indexOf(47) > 0)
                    alert(' Mobile Number is ' + val + );
            });







提前致谢

Harshal




Thanks in advance
Harshal

推荐答案

.each(obj,function(i,val){
if (val.indexOf( 47 )> 0
alert( ' 手机号码是' + val +);
});
.each(obj, function (i, val) { if (val.indexOf(47) > 0) alert(' Mobile Number is ' + val + ); });







提前致谢

Harshal




Thanks in advance
Harshal


这是一个问题吗?彼得和Chill60只? :)。如果不是,我将提供如下代码示例代码。



Is this question to Peter and Chill60 only ? :). If not i am giving the example code like the following.

var obj = ['123456798','123567890'];


.each(obj,function(i,val){
if ( val.indexOf( 4 < 0
alert(val);
});
.each(obj, function (i, val) { if(val.indexOf(4)< 0) alert(val); });



此脚本的输出将是,它会跳过包含4的phonenumbers您的查询。


Output of this script will be, it skips the phonenumbers that are containing 4 as per your query.


这篇关于Jquery中的索引问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆