I have a .asp page that loads some frames and I need to access their content.
I tried to use jquery .contents() method by replicating the official example from the documentation but even that doesn't work.
Here's my code snippets
HOME.HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>contents demo</title>
<script src="jquery-1.12.4.js"></script>
</head>
<body>
<iframe src="mycom.html" width="80%" height="600" id="frameDemo"></iframe>
<script>
$( "#frameDemo" ).contents().find( "div" ).css( "background-color", "#BADA55" );
</script>
</body>
</html>
MYCOM.HTML
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="foo"><H1>MYCOM FRAME!</H1></div>
</body>
</html>
Also using .load
on the frame to ensure that its content is fully loaded does not work.
What am I doing wrong?