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>&nbsp;</td>");
			element+="<td>&nbsp;</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

Recommended Answers

All 4 Replies

Member Avatar for stbuchok

I would help, except that this seems to be a homework assignment. Look up on Google how to debug JavaScript and that should help you to be able to learn to solve these issues on your own.

To get you started:
Firebug (Firefox)
Web Developer Toolbar (IE)
Developer Tools (Chrome)

I've also found Visual Studio helpful (attach process to iexplore.exe)

this is not an homework assignment its just learning javascript (jQuery)...

If you look closely:

Hello! Sorry for asking but i have really big favor to ask. If anyone is so kind to help me do that i would really appreciate it. I wouldn't even think to ask like that but have a due date till tomorrow. I know its last second but I was detained from health issues.

Due date was... like week ago... I want to do this for myself... And thanks, I did it. With your help ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.