2015-05-25 194 views

回答

2
$("#buttonid").click(function(){ 
    //do stuff 
    $(this).prop('disabled', true); 
    setTimeout(function(){ 
     $(this).prop('disabled', false); 
    }, 500); 
}); 
0

可以重新綁定setTimeout和內解除綁定單擊處理(每當下一個點擊出現)的單擊事件像

function bindClick(){ 
    $('#button').bind('click',function(){ 
     ...click code here... 

     $('#button').unbind('click'); 
     setTimeout(bindClick, 200); 
    }); 
} 

注意,這將不會重新綁定每200毫秒,只有當點擊發生時。

DEMO

+1

'setInterval' - 你能肯定嗎? – Oka

+0

是的,這將重新在200毫秒 – AmmarCSE

+1

並再次,一次又一次。 – Oka