Jquery。每个Div都在Div内部 [英] Jquery .each through Divs inside another Div

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

问题描述

我目前有以下的html:

I currently have the following html:

编辑道歉,我写这个时没在意。

Apologies for edit, I was not paying attention when i wrote this.

 <div class ="left">
    <div>1</div>
    <div>2</div>
    <div>3</div>
</div>

我使用JQuery .each命令遍历每个div,使用 $ ( 'DIV')。每个。尽管我只想通过类名left迭代div内的div。

I am using the JQuery .each command to iterate through each div using $('div').each. Although I only want to iterate through the divs inside the div with the class name 'left'.

我试过用 $('。left> div')。,但它没有用。

I have tried using $('.left > div').each but it did not work.

任何帮助表示赞赏。

推荐答案

$.each( $('.left'), function(i, left) {
   $('div', left).each(function() {

   });
})

这篇关于Jquery。每个Div都在Div内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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