选择 .button 其中 data-source 等于 all
Posted
技术标签:
【中文标题】选择 .button 其中 data-source 等于 all【英文标题】:Select .button where data-source equals all 【发布时间】:2012-08-17 07:44:27 【问题描述】:正如问题标题中提到的,我正在尝试选择 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');
还有其他想法吗?
【问题讨论】:
【参考方案1】:我想你想要
$('a.button[data-source=all]').css('background', 'red');
【讨论】:
【参考方案2】:试试这个:
$('.button').filter(function()
return $(this).data('source') == "all"
).css('background', 'red');
【讨论】:
以上是关于选择 .button 其中 data-source 等于 all的主要内容,如果未能解决你的问题,请参考以下文章