I have an element:
<input type="file" id="fileUpload" size="100" name="fileUpload"/>
A change event is bound to this element i.e. :
$('input[type=file]').change(f开发者_StackOverflow中文版unction()
{
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);
jQuery clone
精彩评论