close

動態產生的button,click後因需求鎖定一定時間後解鎖

var time ;

function DisableEnable(){

time = 30;

$(function(){ 

timeout = setTimeout(abc,1000);

});

}

 

function abc(){

if(time == 0){

$.each($('input[name^button]'),function(){

$(this).val('更新');

$(this).prop( 'disabled' , false ); 

});

clearTimeout(timeout);

}else{

time--; 

$.each($('input[name^button]'),function(){

$(this).val( '鎖定' + time );

$(this).prop( 'disabled' , true);

});

setTimeout(abc,1000);

}

};

arrow
arrow
    全站熱搜

    KaRno 發表在 痞客邦 留言(0) 人氣()