It is very strange. I have a simple form. I have a file entry element outside this form.
The user clicks the file entry element and selects the file. I am cloning the input file with this code:
$('input[name="song[attachment]"]').clone(true).appendTo('form')
In all browsers: FF, Opera, Safari, Chrome, when I check the form element, I see the input element of the cloned file inside the form. However, when I submit the form to FF and Opera, it works. Safari and Chrome submit a form with an empty file input.
I notice when a file input element is cloned and added to a form element, it does not copy its values. It only clones the empty element of the input file. This is normal?
Is there something wrong with my jQuery code? Or is it a security issue, and why are Safari and Chrome preventing me from doing this? If the latter, why FF and Opera do differently?
jquery cross-browser
Christian fazzini
source share