Fero
Fero

Reputation: 13315

jquery code working in firefox but not in chrome and IE 8?

In this code i am disabling the submit button when i clicked once and after 3000 ms i am making it enable..

This is working fine in Firefox but not in Chrome..

What's the wrong with this code ?

    // to make all the submit button disable due to avoid duplicate entries.
    $('.logged-in #edit-submit').click(function(){
        var input = this;
        input.disabled = true;
        setTimeout(function() {
           input.disabled = false;
        }, 3000);

  });

Upvotes: 0

Views: 260

Answers (1)

cscharr
cscharr

Reputation: 26

The "disabled" attribute needs "disabled" as value (Doc). Best set and remove attributes with jQuery tools:

$('.logged-in #edit-submit').click(function(){
    var input = this;
    $(input).attr("disabled", "disabled");
    setTimeout(function() {
       $(input).removeAttr("disabled");
    }, 3000);
});

You can see it working here: http://jsfiddle.net/christians/U9eDw/

Upvotes: 1

Related Questions