I got an iframe that i use to upload a file to my server. I want to pass to the iframe the name i want for the file, but i haven't been able to do it.
I got this content in my iframe:
<html>
<body>
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file"><br>
<input type="hidden" name="idProductoFormUpload" id="idProductoFormUpload" value="test">
<input type="submit" name="submit" value="Enviar">
</form>
code of the iframe element:
<iframe id="iframeUpload" name="iframeUpload" src="uploadForm.html" style="height:100px;"></iframe>
All i want to do is set the value for the 'idProductoFormUpload' input.
I tried this with no success:
$('#iframeUpload').contents().find('#idProductoFormUpload').val('myValue');
Your code is good. I often ran into this problem too. Make sure you put the javascript AFTER the iframe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With