我知道這已被問過,但我不能完全得到如何在一個onclick甚至添加我的特定功能的語法。我可以在一個元素中有兩個jQuery的onclick事件嗎?
當前的onclick代碼:
<a class="thumbLinkCart" href="#" onclick="simpleCart.add('name=lemon','price=7.99','image=images/thumbs/yellowgold.jpg');return false;"></a>
第二個事件添加:
<script>
$(document).ready(function() {
$('#demo12').click(function() {
$.growlUI('Item added to cart');
});
});
</script>
有人能幫助我添加第二個功能,第一onclick事件吧。
刪除內聯事件處理程序,並與jQuery結合他們倆。 –
還添加'id ='demo12''屬性,表示jQuery可以找到鏈接 – metadings
謝謝,工作起來就像一個魅力! – user2487746