Search code examples
jqueryjquery-selectorsattributesjquery-filter

Select .button where data-source equals all


As mentioned in the question's title, I'm trying to select the a.button where :data(source==all) but with no success, here's what I've tried

$('.button:data("source==all")').css('background', 'red');
$('#sources-list li').find('.button:data("source==all")').css('background', 'red');
$('#sources-list li').find('.button:data("source=all")').css('background', 'red');

Any other ideas?


Solution

  • I think you want

    $('a.button[data-source=all]').css('background', 'red');