下面的代碼為什么不對?
<script type="text/javascript">
? ? ? ??
? ? ? ? //this指向button元素
? ? ? ? $("button:eq(1)").click(function() {
? ? ? ? ? ? $('p').click(function(e) {
? ? ? ? ? ? alert(e.target.textContent)
? ? ? ? }) //指定觸發綁定的事件
? ? ? ? })
? ? </script>
2017-06-01
沒有區別,你只是把那個綁定的觸發事件寫在了內部
2016-10-24
如果只有一個按鈕的話應該是:eq(0)?