I am making an upload form and I want users to add more input file fields to the form if they require using jquery if they want to upload more than one file. This is the code I have so far below that isn't working. You can also see this on js fiddle: http://jsfiddle.net/benpaton/JUJxn/
Thanks in advance.
$(function () {
$('#add-more-files').click(function() {
var cloned = $(this).prev().clone();
cloned.val(null);
$(cloned).insertBefore($(this));
});
});
<ul>
<form enctype="multipart/form-data" action="" method="post">
<li>Choose a file to upload:</li>
<li><input name="uploadedfile" type="file" size="40" /></li>
<li><a href="" id="add-more-files">Add file upload box</a></li>
<li><input type="submit" value="Upload File" /></li>
</form>
</ul>