jquery 遍历

<div><p>1</p><p>2</p><p>3</p></div>
方法一:
<script language="javascript">
$("div").each(function(){
        $('p', this).click(function(){alert($(this).html())})
                  
                  });
</script>
方法二:
<script language="javascript">
$("div p").each(function(){
        $(this).click(function(){alert($(this).html())})
                  
                  });
</script>
posted @ 2009-08-06 15:16  朝夕  阅读(2000)  评论(0编辑  收藏  举报