removeProp after timeout not working?

Hi,

Can anyone tell me why this isn’t working? Adding the prop works but it’s not removed 500ms later?

$('button').click(function(){
    $(this).prop('disabled', true);
    setTimeout(function(){
      $(this).removeProp('disabled');
    }, 500);
});

The first this refers to the button

The second this refers to the window. The window doesn’t have the property you are trying to remove.

1 Like

Thank you good sir. Worked when saving the clicked button as variable var self = $(this);

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.