0
點擊事件不適用於複製的HTML嗎?單擊事件不適用於複製的HTML
<ul class="dir">//the given ul
<li> <img class="thumb" src="1.jpg" > </li>
<li> <img class="thumb" src="2.jpg" > </li>
<li> <img class="thumb" src="3.jpg" > </li>
<li> <img class="thumb" src="4.jpg" > </li>
<li> <img class="thumb" src="5.jpg" > </li>
<li> <img class="thumb" src="6.jpg" > </li>
<li> <img class="thumb" src="7.jpg" > </li>
</ul>
<ul class="copy"></ul> //copied ul
<script>
$(function(){
$(".copy").html($(".dir").html());
$(".thumb").click(function(){
alert("It works only on the .dir's thumb not on .copy's thumb .. why?");
}
);
}
</script>
它工作良好。感謝名單 – 2014-10-04 21:51:02