Hello, whenever I try to call this function, web developer plugin for firefox gives me a message that says: "Error: addRow is not defined
Source File: http://localhost/xampp/Aptana/index.php
Line: 1"
Here is my code:
<script type="text/javascript">
var k = 7;
function addRow()
{
var rowItem = document.createElement('input');
newRow.setAttribute('type', 'text');
newRow.setAttribute('name', 'item' + k);
document.getElementById('myDiv').appendChild(rowItem);
var rowPart = document.createElement('input');
newRow.setAttribute('type', 'text');
newRow.setAttribute('name', 'part' + k);
document.getElementById('myDiv').appendChild(rowPart);
k++;
}
</script>
<form>
<input type="button" value="Add a Row" onclick="addRow()" />
</form>