$('#sub').click(function () {
    var self = $(this);                        
    if( oneshotbtn(self,2000,'#01b637') ){
        return false;
    }
});

function oneshotbtn(btn_el,delay,color) {
    oneshotbtn.submit_flag = oneshotbtn.submit_flag || false;

    setTimeout(function () {
        oneshotbtn.submit_flag = true;
        btn_el.css('background-color','#888');
        btn_el.prop('disabled', true);
    }, 10);
    setTimeout(function () {
        oneshotbtn.submit_flag = false;
        btn_el.css('background-color',color);
        btn_el.prop('disabled', false);
    }, delay);            
    return oneshotbtn.submit_flag;
}

 

相关文章:

  • 2022-12-23
  • 2021-10-10
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-15
  • 2022-12-23
猜你喜欢
  • 2021-11-14
  • 2021-12-12
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
相关资源
相似解决方案