0

この例では rgb(255,0,0) で、特定のテキストの色を持つリスト内のアイテムの ID を取得したいと考えています。if ステートメントまですべてが機能します。比較演算子と色について知っておくべきことはありますか?

$('.jqshow li').click(function() {
$('.jqshow li').attr('style', 'color:black');
$(this).attr('style','color:rgb(255,0,0)');
$('.jqshow li').each(function(i){
  var getcolor = $(this).css('color');
  if(getcolor != 'rgb(255,0,0)') {
    var getid = $(this).attr('id')
    alert(getid);
}
})  
    })
4

0 に答える 0