如问题标题中所述,我正在尝试选择a.button
,其中:data(source==all)
没有成功,以下是我尝试的内容
$('.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');
还有其他想法吗?
我想你想要
$('a.button[data-source=all]').css('background', 'red');
试试这个:
$('.button').filter(function(){
return $(this).data('source') == "all"
}).css('background', 'red');