I got a little confused with the following code:
HTML:
<div class="playerContainer"> <iframe id="playerFrame" name="playerFrame" frameborder="0"></iframe> <div class="playerContainer">
Javascript:
var playerFrame1 = $("#playerFrame"); var playerFrame2 = window.frames["playerFrame"]; alert(playerFrame1);
My first question is why we get 2 different outputs.
When I try to embed a webpage using playerFrame1 as an identifier, nothing happens. But everything works fine with playerFrame2. Does anyone know why?
Thanks.
PS: I also tried
$('playerFrame'), $(iframe[name="playerFrame"]), document.getElementById("playerFrame")
Without changes.
source share