我想根据自定义字段中的值更改<tr>
的背景颜色。
(它将采用十六进制代码 - &gt; <td class="customfield_13209"> #FF0000 </td>
)
下面的代码示例。
我该怎么做?
<tr id="issuerow322848" rel="322848" data-issuekey="CA-17059" class="issuerow">
<td class="issuekey">
<a class="hidden-link issue-link" data-issue-key="CA-17059" href="/jira/browse/CA-17059" tabindex="-1" title="CA-17059"></a>
<a class="issue-link" data-issue-key="CA-17059" href="/jira/browse/CA-17059">CA-17059</a>
</td>
<td class="summary">
<p>
<a class="issue-link parentIssue" data-issue-key="CA-17055" href="/jira/browse/CA-17055" title="Title of issue">CA-17055</a>
<a class="issue-link" data-issue-key="CA-17059" href="/jira/browse/CA-17059">Jon Smith</a>
</p>
</td>
<td class="assignee"> <span class="tinylink"> <a class="user-hover" rel="jsmith" id="assignee_jsmith" href="/jira/secure/ViewProfile.jspa?name=rprowadzisz">Jon Smith </a></span>
</td>
<td class="status">
<span class=" span class not important" data-tooltip="<span class="jira-issue-status-tooltip-title">Backlog</span>" title="" original-title="">Backlog</span>
</td>
<td class="updated"> <span title="2016-05-19 11:24 AM"><time datetime="2016-05-19T11:24:53+0200">2016-05-19</time></span> </td>
<td class="aggregatetimeestimate"></td>
<td class="customfield_13209"> #FF0000
</td>
<td class="issue_actions">
<div class="action-dropdown aui-dd-parent">
<a class="aui-dropdown-trigger aui-dd-link icon-tools-small issue-actions-trigger trigger-happy" id="actions_322848" title="Actions (Type . to access issue actions)" href="herif">
<span>
<em>Actions</em>
</span>
</a>
</div>
</td>
答案 0 :(得分:0)
以下是更改包含十六进制颜色的单元格的背景颜色的解决方案。您应该能够修改它以获得您想要的结果。
var cells = document.getElementsByClassName('customfield_13209');
for (var i = 0; i < cells.length; i++) {
cells[i].style['background-color'] = cells[i].innerHTML;
}
这是一个有效的JSFiddle
答案 1 :(得分:0)
$(document).ready(function(){
if($('.customfield_13209').val() == "your desire"){
$(this).css('background-color', '#FF0000');
}
});
这是jQuery,但如果它能帮助你解决问题,那我就很满意。