Created
April 22, 2014 09:43
-
-
Save standa/11172219 to your computer and use it in GitHub Desktop.
Insert input file dynamically using javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// works on jQuery 1.9+ | |
$(document).on('change', '.soubor', function () { | |
if ($(this).val() != '') { | |
var id = $('.soubor').length + 1; | |
$('<input>', {type: 'file', name: 'soubor'+id, id: 'soubor'+id, 'class': 'soubor form-control'}) | |
.insertAfter($('.soubor').last()); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment