I have a click event that loads an iframe, which is followed by a .load(function() for the iframe. The problem is the load function gets fired twice for each click event. Can someone explain me the reason why this is happening? And how can it be prevented?
$(document).ready(function() {
$('.Popup').click(function() {
$('#myiframe').attr('src', $(this).attr('href')).load(function() {
alert('done loading')
})
return false;
});
});