It doesnt matter if you cancel an image because it checks the current count inside the div once it is clicked.
Code:
To add new input file field dynamically, on click of "Add More Files" button below function will be executed
$('#add_more').click(function() {
if($('#im_container').children('#filediv').length<10){
$(this).after($("<div/>", {id: 'filediv'}).fadeIn('slow').append(
$("<input/>", {name: 'pic[]', type: 'file', id: 'file'}),
$("<br>")
));
}
});
Please change id="filediv" to class="filediv" once you change that then use this
Code:
To add new input file field dynamically, on click of "Add More Files" button below function will be executed
$('#add_more').click(function() {
if($('#im_container').children('.filediv').length<10){
$(this).after($("<div/>", {id: 'filediv'}).fadeIn('slow').append(
$("<input/>", {name: 'pic[]', type: 'file', id: 'file'}),
$("<br>")
));
}
});
Bookmarks