R K R K - 2 years ago 78
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.

Answer Source

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

$(window).on.('load', function () {
    alert('All content loaded.');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download