Hello,

I'm not too familiar with Javascript so Im hoping someone here can help.

Script: image upload script but the focus is on the javascript.

The javascript, as of now give the user a new field to upload a image every time a the "add image" button clicked.

Problem: The script works for most part but it gives the user unlimited upload fields click.

Need:
-control the number of times a user can click the "add image" button.
- if one of the file is removed, the "add image" button should be enabled again to add another image.



I also attached a image to the post for you view.
java.jpg

Code:
<script>
	
$(function() { $('#add-file-field').click(function() { $("#addField").append('<div class="added-field"><input type="file" name="data[]"><input type="image" src="delete.png" class="remove-btn" value="Remove"></div>'); }); $('.remove-btn').live('click',function() { $(this).parent().remove(); }); });
</script>
any help you can provide me would be greatly appreciated
r