關(guān)于toggle事件
$(function(){
? ? ? ? ? ? ? ? ? $(#btntest).bind("click",function(){
? ? ? ? ? ? ? ? ? ? $("div").toggle(function(){
? ? ? ? ? ? ? ? ? ? ? ?$(this).hide();?
? ? ? ? ? ? ? ? ? ? },function(){$(this).show();}); ?
? ? ? ? ? ? ? ? ? }) ? ?
? ? ? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? });
點(diǎn)擊button,div沒(méi)有反應(yīng),請(qǐng)問(wèn)這段代碼錯(cuò)在哪里?
2016-03-30
$(#btntest).bind("click",function(){
$("#btntest")沒(méi)加"";
并且 這個(gè)并不需要這么麻煩--->綁定按鈕后用div直接調(diào)用toggle方法就行