JSFiddle - React, Tailwind, and code Playground
HTML
<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>
<tbody>
</tbody>
</table>
CSS
.slika
{
width:20px;
height:20px;
}
tr
{
background-color:white;
}
tr.highlight
{
background-color:yellow;
}
JavaScript
$(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 thead tr").click(function() {
$(this).css("backgroundColor", "red");
});
});