0

This is not working on Google-Chrome, but on Firefox it works. it does disable the button on click but the login form is not posting and on Firefox I am able to login but not working on Chrome, click is disabled but can't login for some reason, removing this script fixes the problem.

var fewSeconds = 10;
    $('#btnLogin').click(function () {
        var btn = $(this);
        btn.prop('disabled', true);
        setTimeout(function () {
        btn.prop('disabled', false);
    }, fewSeconds * 1000);
});

The script below is causing the same problem, still unable to login, button click is disabled but the post is not happening

var fewSeconds = 10;
$('#btnLogin').click(function () {
    $('#btnLogin').attr('disabled', 'disabled');
    setTimeout(function () {
    $('#btnLogin').attr('disabled', '');
    }, 2000);
});
Bmuzammil
  • 31
  • 9
  • Are you getting any errors in the console? Post a [mcve] please. [A simplified version of your code works](https://jsfiddle.net/t3zszqha/), so you'll need to post the code that doesn't. – j08691 Aug 30 '17 at 18:17
  • Its working perfectly on my chrome – Ananthakrishnan Baji Aug 30 '17 at 18:21
  • Possible duplicate of [jQuery .prop("disabled", false) not working in Chrome](https://stackoverflow.com/questions/9240439/jquery-propdisabled-false-not-working-in-chrome) – Nikhil G Aug 30 '17 at 18:23
  • it does disable the button click but, the form is not posting, I have this on login page and on firefox I am able to login but not on Chrome, click is disabled but can't login for some reason. – Bmuzammil Aug 30 '17 at 18:24
  • You still need to post a [mcve] as the code you posted so far doesn't have any issues – j08691 Aug 30 '17 at 18:26

1 Answers1

0

I did not find any solution online, so I tried this script instead and it worked for me and I hope it might help someone too:

$('#btnLogin').click(function () {
    $('#btnLogin').hide();
    $('#btnWait').show();
    setTimeout("$('#btnWait').hide();", 10000);
    setTimeout("$('#btnLogin').show();", 10000);
});
Bmuzammil
  • 31
  • 9