I have a table header as
<table class="tablestyle" id="tabHistory">
<tr>
<th style="min-width:15%;" onclick="javascript:doSort('0', 'Test Name');"> name</th>
<th style="min-width:18%;" onclick="javascript:doSort('1', 'platform');">Plat</th>
<th style="min-width:20%;" onclick="javascript:doSort('2', 'Test Server');"> Server</th>
<th style="width:3%;"></th>
<tr>
</table>
code
function doSort(index, column) {
var sortIndex = 'i' + index;
sortOrder[sortIndex] = (sortOrder[sortIndex] == "asc") ? "desc" : "asc";
var options = {"sortby":column, "order":sortOrder[sortIndex]};
displayHistory(options, function() {
var bgImg = (sortOrder[sortIndex] == "asc") ? "./images/asc.gif" : "./images/desc.gif";
$("#tabHistory th").eq(index).css({
"background-image": "url(" + bgImg + ")"
});
});
}
Here in the table head showing images in every header. I want to show images only in name and server headers not in plat header. How can i hide the image from the plat header?
You can use .eq()
selector:
$("#tabHistory th:eq(0),#tabHistory th:eq(2)").css({
"background-image": "url(" + bgImg + ")"
});
另外,您也可以从Plat th省略背景图像,如下所示:
$( "#tabHistory tr th:contains('Plat')" ).css( "background-image", "" );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.