<head>
????<title>Title</title>
????<script?type="text/javascript"?src="js/jquery-1.8.3.min.js"></script>
????<script?type="text/javascript">
????$(document).ready(function?()?{
????????$("div").each(function?(index,ele)?{
????????????var?s?=?$(this)[index].innerHTML;
????????????alert(index?+?"?"?+?s);
????????});
????});
</script>
</head>
<body>
????<div>bnm</div>
????<div>a</div>
????<div>b</div>
????<div?class="b">c</div>
</body>我把每個div節(jié)點用[index]轉成javascript對象后,為什么彈窗只出現(xiàn)一次呢?怎么后面的div都訪問不到了?
jQuery的each方法怎么獲取節(jié)點的文本
fenkapian
2017-03-30 11:16:38