qq_21741673
洗洗脚泡泡澡
2016-02-25 07:34

jquery获取相同class的div并绑定点击事件

  • jquery
<div id="outadded_content">
            <div class="outadded_menu">
                <img style="height:65%;width:80%;" src="../image/more.png" />
                <span>菜单1</span>
            </div>
            <div class="outadded_menu">
                <img style="height:65%;width:80%;" src="../image/more.png" />
                <span>菜单2</span>
            </div>
            <div class="outadded_menu">
                <img style="height:65%;width:80%;" src="../image/more.png" />
                <div>菜单3</div>
            </div>
            <div class="outadded_menu">
                <img style="height:65%;width:80%;" src="../image/more.png" />
                <span>菜单4</span>
            </div>
            <div class="outadded_menu" id="a">
                <img style="height:65%;width:80%;" src="../image/more.png" />
                <span>菜单5</span>
            </div>
        </div>

需要用jquery获取class为outadded_menu的div对象,并且绑定点击事件,获取所点击的div的id的值。

在线等...

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

8条回答