Here it is again. I don't get any error message it just doesn't delete. If the function can be shorter that would be great but this is a test of a funciton in a jquery page where the DOM elements are added through AJAX so I don't know what the row of the element is that would be clicked and the list is dynamic and there is also another form on the page.
HTML>
<HEAD>
<script type="text/javascript">
function deleteRow(button){
alert("hello");
var row,rows,rownum,elems,elnum,loop;
rows=document.getElementById('todo-list').getElementsByTagName('li');
rownum=rows.length;
loop=true;
while(rownum--){
row=rows.item(rownum);
elems=row.getElementsByTagName('input').type('button');
elnum=elems.length;
while(elnum--){
if(elems.item(elnum)=="button"){
loop=false;
break;
}
}
if(!loop){
deleteRow();
}
}
}
// "row" is the dom element of the row you wish to delete
// "elems" is elements within row
}
</script>
</HEAD>
<BODY>
<form>
<ul id="todo-list">
<li "class" = "todo-list" >
<input type="checkbox" id="task" checked="false" />task 1
<input type="button" value="Delete" onclick="deleteRow(this)" />
</li>
<li "class" = "todo-list" >
<input type="checkbox" id="task" checked="false" />task 2
<input type="button" value="Delete" onclick="deleteRow(this)" />
</li>
<li "class" = "todo-list" >
<input type="checkbox" id="task" checked="false" />task 3
<input type="button" value="Delete" onclick="deleteRow(this)" />
</li>
</ul>
</form>
</BODY>
</HTML>
[/html>