I'm trying to change the src of an iframe upon submitting a form.
The iframe src won't change unless I hit the submit button twice. However, if I just change the input 'type' for my submit button to 'text', it works on the first click - but obviously doesn't submit the form.
<script>
$(document).ready(function() {
$("#form1").submit(function() {
$('#upload_frame').attr('src','upload-test.php');
});
});
</script>
<form action="" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input id="file" type="file" name="file" />
<input name="Submit" id="submit" type="submit" value="Submit" />
<br />
<iframe id="upload_frame" name="upload_frame"> </iframe>
</form>