I have a function:-
function resetInputFile(elem) {
elem.wrap('<form>').closest('form').get(0).reset();
elem.unwrap();
}
I call the function like this:-
resetInputFile(document.queryElement('#image'));
How can I convert the LOCs
elem.wrap('<form>').closest('form').get(0).reset();
elem.unwrap();
into pure javascript?
I want to implement the logic in ReactJS, but I don't want to use jquery with ReactJS. So I need to do it with pure javascript.
document.getElementById("myFile").value = "";document.getElementById("myFile").value = ""doesn't clear the previously selected file from the file input. I had tested it before and that's why I chose wrap() and unwrap() method previously in another PHP project where I could use JQuery.