所屬章節課程:函數表達式: 用一個變數來代替函數(名稱不固定)
var show=function (){ var info="<div>你好</div>"; $(this).after(info); $(this).unbind('click');//删除点击事件 } $("img").click(show);
2018-11-070个赞
这个会经常用到。
2018-11-070个赞
$(document).ready(function(){ $("btn").click(function(event){ if($(this.text()==="显示")){ $("#content").show(); $(this).text("隐藏"); } else{ $("#content").hide(); $(this).text("显示"); } }); });
2018-11-070个赞