下面兩種方式都可以實現,有什么區別呢
$(function(){
? ? ? ? ? $("#close").on("click",function(){
? ? ? ? ? ? ? $(this).alert("close");
? ? ? ? ? });
? ? ? ? ? });
和
$(function(){
? ? ? ? ? $("#close").click(function(){
? ? ? ? ? ? ? $(this).alert("close");
? ? ? ? ? });
? ? ? ? ? });
2016-06-30
一個是更規范的寫法可以更好的識別元素信息第二種更加簡潔。第一種寫法更加規范一直使用這種方式是一個好習慣