I have an element
<input type="file" id="fileUpload" size="100" name="fileUpload"/>
A change event is bound to this element ie
$('input[type=file]').change(function()
{
alert('changed');
});
I am cloning this element using
var newElement = $('#fileUpload').clone();
and appending newElement to the form
$('form').append(newElement);
Now what happens is that after appending the change event is not bound to the new element. Any idea why this is and how to solve this?
var newElement = $('#fileUpload').clone(true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.