i have a javascript function that creates inputfields for uploading images.
i have this code:
<script type="text/javascript">
function add_input(){
var wo = document.getElementById('wo');
var li = document.createElement('li');
var input = document.createElement('input');
input.type = 'file';
input.name = 'image[]';
li.appendChild(input);
li.appendChild(document.createTextNode(' '));
var button=document.createElement('input');
button.type = 'button';
button.className = 'button small';
button.onclick=function(){delete_input(this);};
button.value = 'delete';
li.appendChild(button);
wo.appendChild(li);
}
function delete_input(feld){
feld.parentNode.parentNode.removeChild(feld.parentNode);
}
</script>
now my problem is that i would like to create as a maximum 10 inputfields. i never used javascript before and dont know how to limit that.
if there is someone who could tell me how to realize that i would really appreciate. thanks a lot.
modify your script so that it will have: