【发布时间】:2018-08-30 10:11:45
【问题描述】:
我有两个 CSS 类,如下所示。
.disabled {
font-color: #ccc;
}
.grayout {
opacity: 0.6;
filter: alpha(opacity=60);
}
我在下面的 jquery 代码中使用了它们。
$('#priority_choices li:first-child .move_up').addClass("disabled grayout");
这是应用css样式后链接的显示方式
我需要应用一些其他样式来更改颜色。但是当我应用font-color : #ddd; 时,只有颜色或箭头会改变。
我检查了代码,并且样式应用于以下通用文件中的单词。所以这种风格适用于应用程序的所有 a.iconic_link 跨度。
a.iconic_link span {
color: #003399;
text-decoration: underline;
margin-left: 2px;
}
我如何才能仅为该元素更改颜色 #003399。
已编辑
这是与 ruby on rails 一起使用的 html 代码。
<%= form_tag respond_round_path(round), :remote => true do %>
<ul id="priority_choices">
<% round.item_version.metadata["responses"].each_with_index do |r, i| %>
<li id="choice_<%= i %>">
<div class="movers">
<%= iconic_link_to_function "arrow-up", "Up", "moveUp(#{i})", :class => "move_up", :data_label_up => "Option " +r.gsub('<p>', '').gsub('</p>', '').html_safe + " Move Up Selected", :option_label_up => r.gsub('<p>', '').gsub('</p>', '').html_safe %>
<%= iconic_link_to_function "arrow-down", "Down", "moveDown(#{i})", :class => "move_down", :data_label_down => "Option "+ r.gsub('<p>', '').gsub('</p>', '').html_safe + " Move Down Selected", :option_label_down => r.gsub('<p>', '').gsub('</p>', '').html_safe %>
</div>
<%= r.gsub('<li>', '').gsub('</li>', '<br />').html_safe %>
</li>
<% end %>
</ul>
<%= submit_tag "Submit response" %>
<%= hidden_field_tag "response" %>
<% end %>
我在下面的函数中应用 css。
function updateButtons() {
$('#priority_choices li:first-child .move_up').addClass("disabled grayout");
}
谢谢
【问题讨论】:
-
你应用css的代码在哪里?
-
我的功能是,updatebuttons(){$('#priority_choices li:first-child .move_up').addClass("disabled grayout");}
-
你的html代码在哪里?
-
由于这个 jQuery 代码和 CSS 将在渲染后运行,因此请同时发布渲染后的 HTML,因为这是这个问题的核心。
-
font-color在 css 中不存在。应该是color。
标签: jquery html css ruby-on-rails