Jquery .each函数迭代问题 [英] Jquery .each function iteration problem

查看:66
本文介绍了Jquery .each函数迭代问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的功能如下。

 $(#ContentPlaceHolder1_datalstPalylist> tbody> tr)。each(function(index){
index = index;
$(this).find(td:> table [id = myplayertable] tr)。each(function(index1){
var id1 = index +'_' + index1;
alert(id1);
Playerid.push('m'+ id1)
});
});



你能不能帮我说

第二个每个函数对哪个DOM元素td,table [id = myplayertable]或tr?

起作用因为如果我写了第二个.each函数,如下输出相同。

 $(this).find(td:> table [id = myplayertable]) .each(function(index1)

解决方案

(#ContentPlaceHolder1_datalstPalylist> tbody> tr)。each(function(index) {
index = index;


(this).find(td:> table [id = myplayertable] tr)。each(function(index1){
var id1 = index +'_'+ index1;
alert(id1);
Playerid.push(' m'+ id1)
});
});



你可以帮我说

第二个每个函数作用于哪个DOM元素td,表[id = myplayertable]或tr?

因为如果我写第二个.each函数如下,则输出相同。

 


(this).find(td:> table [id = myplayertable])。each(function(index1)


I have function like the following.

$("#ContentPlaceHolder1_datalstPalylist > tbody > tr").each(function (index) {
                    index = index;
                    $(this).find("td: > table[id=myplayertable] tr").each(function (index1) {
                        var id1 = index + '_' + index1;
                        alert(id1);
                        Playerid.push('m' + id1)
                    });
                });


Can you kindly help me by saying
the 2nd each function acts on which DOM element td, table[id=myplayertable] or tr?
Because if I write the 2nd .each function like following the output is same.

$(this).find("td: > table[id=myplayertable]").each(function (index1)

解决方案

("#ContentPlaceHolder1_datalstPalylist > tbody > tr").each(function (index) { index = index;


(this).find("td: > table[id=myplayertable] tr").each(function (index1) { var id1 = index + '_' + index1; alert(id1); Playerid.push('m' + id1) }); });


Can you kindly help me by saying
the 2nd each function acts on which DOM element td, table[id=myplayertable] or tr?
Because if I write the 2nd .each function like following the output is same.


(this).find("td: > table[id=myplayertable]").each(function (index1)


这篇关于Jquery .each函数迭代问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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