R K R K - 5 months ago 27
jQuery Question

Alert not showing after loading entire content of all iframes on page

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
<iframe width="400px" src="http://www.w3schools.com"></iframe>
<iframe width="400px" src="http://www.phpacademy.org"></iframe>
<iframe width="400px" src="http://www.jquery.com"></iframe>
<script type="text/javascript" src="js/jquery-3.1.1.min.js" ></script>
<script type="text/javascript" src="js/custom.js" ></script>

below is code in custom.js

$(window).(on.('load', function () {
alert('All content loaded.');

I want the alert to display when all the three iframes are loaded on the page.


The syntax you used for load is wrong, you should use

$(window).on.('load', function () {
    alert('All content loaded.');