Bhawna Malhotra
Bhawna Malhotra

Reputation: 490

Adding property disabled not working

I have to disable a button on click.Using below code but its not working. Below code is using jquery

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

Any solution?

Upvotes: 0

Views: 50

Answers (2)

barbq
barbq

Reputation: 21

$('#yourButton').click(function(){
    $(this).attr('disabled', true);
})

Upvotes: 1

user6280452
user6280452

Reputation:

Property and attribute have different behaviours. See here https://stackoverflow.com/a/6004028/4485651

Instead use

$('#someid').attr('disabled', true);

Upvotes: 1

Related Questions