R K R K - 1 month ago 7
jQuery Question

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

<!DOCTYPE html>
<html lang="en">
<head>
<title>
</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
</head>
<body>
<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>
</body>
</html>


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.

Answer

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

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