<div>
<div id="area">
</div>
</div>
<input type="button" value="+" onclick="add();" />
<input type="button" value="-" onclick="remove();" />
<script type="text/javascript">
var e = document.getElementById('area');
function add() {
var c = document.createElement('input');
c.type = 'text';
c.name = 'food[' + e.getElementsByTagName('input').length + ']';
e.appendChild(c);
}
function remove() {
var q = e.getElementsByTagName('input');
q[q.length - 1].parentNode.removeChild(q[q.length - 1]);
}
</script>