I have the following code:
$('#loginLink, #registerLink')
.attr('data-disabled') === 'yes'
I am trying to set the data-disabled attribute on the IDs but it does not seem to work. Am I using the correct jQuery?
I have the following code:
$('#loginLink, #registerLink')
.attr('data-disabled') === 'yes'
I am trying to set the data-disabled attribute on the IDs but it does not seem to work. Am I using the correct jQuery?
You should set the value this way:
$('#loginLink, #registerLink').attr('data-disabled', 'yes');
As data is a property, you can use data method instead:
$('#loginLink, #registerLink').data('disabled', 'yes');
prop for selected or checked properties we should use data for data-* attributes.