我有这段代码:
<span id="sn1">
<a href="javascript:removeEtape(2);" class="glyphicon glyphicon-remove"></a>
<a id="aUn1" href="javascript:upEtape(1,0);" class="glyphicon glyphicon-chevron-up" aria-hidden="true"></a>
<a id="aDn1" href="javascript:downEtape(1,2);" class="glyphicon glyphicon-chevron-down" aria-hidden="true"></a>
my text here<br></span>
选择id“aUn1”后,我需要更改“glyphicon glyphicon-chevron-up”的颜色。
我试试这个但是,它不起作用:
$('#aUn1').attr('[class$="glyphicon-chevron-up"]').css('color', 'grey');
你能帮我吗?
答案 0 :(得分:2)
只需将class
添加到selector
。
$('#aUn1.glyphicon-chevron-up').css('color', 'grey');
答案 1 :(得分:-1)
像这样更新您的代码
$(".glyphicon-chevron-up").css('color', 'grey');