I have read almost every article about this... Just can't find the reason why this isn't working. I want to change my tr background-color using jQuery. There are no errors in web inspector or what so ever, just nothing happens...
My html code:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title>Opravila</title>
<style>
.slika
{
width:20px;
height:20px;
}
tr
{
background-color:white;
}
tr.highlight
{
background-color:yellow;
}
</style>
</head>
<body>
<script src="script.js" type="text/javascript"></script>
<form>
Naslov opravila: <input type="text" id="naslov"></input>
Vrsta opravila: <input type="text" id="vrsta"></input>
Nujnost opravila:
<select id="nujnost">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="button" value="Dodaj opravilo" id="dodaj"></input>
</form>
<img src="minus.png" class="slika" id="slika"></img>
<table id="tabela">
<thead>
<tr>
<th>#</th>
<th>Opravilo</th>
<th>Vrsta</th>
<th>Nujnost</th>
<th>Datum vnosa</th>
</tr>
</thead class="vrstica">
<tbody>
</tbody>
</table>
</body>
</html>
And my jQuery code: (Note that my code for this starts almost at the end)
$(document).ready(function(){
$("#dodaj").click(function() {
var naslov=$("#naslov");
naslov=naslov.val();
var vrsta=$("#vrsta");
vrsta=vrsta.val();
var nujnost=$("#nujnost");
nujnost=nujnost.val();
var zaporedna_st=$("#tabela tbody tr").length;
var datum =new Date();
datum=datum.getDate()+"."+(datum.getMonth()+1)+"."+datum.getFullYear();
$("#tabela tbody").append("<tr><td>"+(zaporedna_st+1)+"</td><td>"+naslov+"</td><td>"+vrsta+"</td><td>"+nujnost+"</td><td>"+datum+"</td></tr>");
});
$("#tabela tbody tr").click(function() {
$(this).css("backgroundColor", "red");
});
});