Reputation: 49
This works:
function rowColors(){
$("table#remotes th").css("background-color", "#202020");
$("table#remotes tr").css("background-color", "#484848");
$("table#remotes tr:visible:odd").css("background-color", "#333333");
}
How can I make this work with a variable table id? This doesn't work:
function rowColors(tblid){
$("table#"+tblid+" th").css("background-color", "#202020");
$("table#"+tblid+" tr").css("background-color", "#484848");
$("table#"+tblid+" tr:visible:odd").css("background-color", "#333333");
}
rowColors(remotes);
Upvotes: 0
Views: 45
Reputation: 207501
Maybe because remotes
is a variable and not a string
rowColors('remotes');
Upvotes: 6