jquery replaceWith implications
- by Vlad Ioffe
I am using replaceWith for input type=file to handle changes of the file the user wants to upload.
I have this code:
$('#add_cv_input').change(function() {
// here is some code
else {
alert('put one of this: pdf doc docx');
$("#add_cv_input").replaceWith('<input id="add_cv_input" type="file"/>');
}
});
now the problem is that this jquery changed event does not being called after the first time that the user had uploaded the wrong extension.
I don't have a clue why this is happening. Everything works fine if at the first time the user uploads a valid extension and then he changes it to other valid extension.