kwek-kwek
kwek-kwek

Reputation: 1343

disabling an input button

I want to disable this button on document ready but I'm new to it so please help:

Here is my code:

   $(document).ready function {
setTimeout("check_user()", 250);
}

please help

Upvotes: 0

Views: 91

Answers (5)

UDigi
UDigi

Reputation: 33

$(document).ready(function(){
    $('#buttonclass').attr('disabled', true);
});

Upvotes: 0

Alnitak
Alnitak

Reputation: 339786

The correct way to disable a button in current versions of jQuery is:

$('#btnid').prop('disabled', true);

.attr() is the old way. See the jQuery 1.6.1 release notes for more information.

Upvotes: 2

genesis
genesis

Reputation: 50976

$(function(){
    $('#button').attr('disabled', 'disabled');
});

Upvotes: 0

Shef
Shef

Reputation: 45589

$(document).ready(function(){
    $('#btnId').attr('disabled', 'disabled');
});

Upvotes: 0

afaf12
afaf12

Reputation: 5426

If button's id is button1, this should work.

$('#button1').attr('disabled', 'disabled');

Upvotes: 4

Related Questions