Hello, I wanna do to do list to look like that: [IMG]http://uss.feri.uni-mb.si/images/Vaje/Vaja_7_jQuery/vaja1.PNG[/IMG] and i need to use jQuery selectors. I can't seem to get it to list a task and create a task. Can anyone please help?
This is the code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
function dodajNovo()
{
var stolpci=5;
var vrstice=5;
var k=0;
var element="";
tabela=document.createElement("table");
//document.writeln("<table>");
element+="<table>";
var stil = "zeleno";
for (i=0; i < vrstice; i++)
{
//if(k%2==0) var stil = "zeleno";
// else stil = "sivo";
//document.writeln("<tr>");
element+="<tr>";
vrstica=document.createElement("tr");
for (j=0; j < stolpci; j++)
{
//document.writeln("<td> </td>");
element+="<td> </td>";
stolpec=document.createElement("td");
vrstica.appendChild(stolpec);
// if (stil == "zeleno") stil = "sivo";
// else stil = "zeleno";
}
k++;
//document.writeln("</tr>");
element+="</tr>";
}
//document.writeln("</table>");
element+="</table>";
tabela.appendChild(tr);
var element1=document.createElement(element);
document.all.mybody.appenChild(tabela); */
tabBody=document.getElementsByTagName("TBODY").item(1);
row=document.createElement("TR");
cell1 = document.createElement("TD");
cell2 = document.createElement("TD");
cell3 = document.createElement("TD");
cell4 = document.createElement("TD");
cell5 = document.createElement("TD");
var result=ime.tekstovno_polje2.value;
//textnode1=document.createTextNode(result);
textnode2=document.createTextNode("test2");
textnode3=document.createTextNode("test3");
textnode4=document.createTextNode("test4");
textnode5=document.createTextNode("test5");
cell1.appendChild(textnode1);
cell2.appendChild(textnode2);
cell3.appendChild(textnode3);
cell4.appendChild(textnode4);
cell5.appendChild(textnode5);
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell4);
row.appendChild(cell5);
tabBody.appendChild(row);
}
</script>
<title></title>
</head>
<body id="mybody">
<table>
<tr>
<td>Naslov opravila:</td>
<td><input name="tekstovno_polje" type="text" autocomplete="on"><br/ ></td>
</tr>
<tr>
<td>Vrsta opravila:</td>
<td><form name="ime"><input name="tekstovno_polje2" type="text" autocomplete="on"><br/ ></form></td>
</tr>
<tr>
<td>Nujnost opravila:</td>
<td>
<select>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
</td>
</tr>
<tr>
<td><button type="button" onClick="dodajNovo()">Dodaj opravilo</button></td>
</tr>
</table>
<table>
<tr>
<th>#</th>
<th>Opravilo</th>
<th>Vrsta</th>
<th>Nujnost</th>
<th>Datum vnosa</th>
</tr>
</table>
<table>
<tbody>
</tbody>
</table>
</body>
</html>
thanks in advance