How can I set an attribute on multiple IDs with jQuery?

jquery

Solution

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');

Problem

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?

Original source

Related problems