what's wrong with this code, first time I click the submit button it loads the iframe once, then clicking it again will load the iframe twice. and so on..
code: JS
$(function() {
$("form").submit(function() {
//
$("form").attr('target','myframe');
$('#myframe').load( function(){
alert('Hello');
});
});
});
HTML:
<form id="form1" name="form1" target="myframe"><input type="submit" value="form1"/></form>
<div id="div1"></div>
<iframe id="myframe" name="myframe" src="mypage.php" style="width:100%;height:400px;border:1px solid #ccc;"></iframe>