0
I’m having a problem using the "Submit();" function on an input type="file" with an onchage passing an id to the function, I ran a test with an Alert and it’s returning me "[Object Htmlformelement]", I don’t know where the problem is.
function autoform(id) {
alert(id);
document.getElementById(id).submit();
}
<form action="" id="form" enctype="multipart/form-data">
<input type="file" onchange="autoform(form);" autocomplete="off">
</form>
It’s all right. The variable
id
passed is the form, and your code is giving aalert()
in the form object. What you would like to do, in fact?– reisdev
I managed to find out where the error was, in autoform(form) missed the apostrophe, would look like this to work: autoform('form')
– João Victor