[問題] script重複執行的問題
code如下,就是body最後的alert搞不懂為何執行兩次?
Thx
0507
========================================
<!DOCTYPE html>
<html>
<head>
<style>
div {background-color:yellow;margin-top:3em;border-style:solid}
</style>
<script src="" rel="nofollow">http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function(){
$('h2').each(function(){
$(this).nextUntil("h2").andSelf().wrapAll('<div/>')
});
});//ready end
</script>
</head>
<body>
<h2>h2 one</h2>
<p>one p</p>
<p>one p</p>
<p>one p</p>
<h2>h2 two</h2>
<p>two p</p>
<p>two p</p>
<p>two p</p>
<h2>h2 three</h2>
<p>three p</p>
<p>three p</p>
<p>three p</p>
<script>
alert("OK")
</script>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.120.39.178
推
05/07 18:06, , 1F
05/07 18:06, 1F
→
05/07 18:11, , 2F
05/07 18:11, 2F
→
05/07 18:11, , 3F
05/07 18:11, 3F
→
05/08 14:46, , 4F
05/08 14:46, 4F
→
05/08 14:48, , 5F
05/08 14:48, 5F
→
05/08 15:05, , 6F
05/08 15:05, 6F
→
05/08 15:06, , 7F
05/08 15:06, 7F
→
05/08 15:07, , 8F
05/08 15:07, 8F
→
05/08 15:08, , 9F
05/08 15:08, 9F
→
05/08 15:08, , 10F
05/08 15:08, 10F
→
05/08 15:58, , 11F
05/08 15:58, 11F
→
05/08 15:58, , 12F
05/08 15:58, 12F