Load iframe in html, only with jquery
- by phpExe
In this jquery code:
$(document).ready(function(){
$list = $(".channeList li");
$list.click(function(){
var $this = $(this);
var $mainDesc = $(".ply");
var iframe = $("a", $this).attr("rel");
$("iframe", $mainDesc).attr("src", iframe);
}
);
}
);
There is a list o channels in left that iframe loads from a rel's. I want to load first iframe in <div class="ply"></div>
In html, I dont want insert the first item.
Can we do this without load first item in html and do this only with jquery?
The php
function channel()
{
if (is_numeric($_GET['kanalID'])) {
$kanalID = $_GET['kanalID'];
}
if ($_GET['kanalID'] == "") {
$kanalID = 1;}
$channel = '<ul class="channeList">';
foreach ($tv as $id => $kanal) {
$class = $kanalID == $id ? $class = "currentt": '';
$channel .= '<li>
<a href="#" rel="http://mysite.com/index.php?id='.$id.'&w=500&h=320" >'.$kanal.'</a></li>';
}
$channel .= '</ul>';
$channel .= '<div class="ply"><iframe frameborder=0 width="500" height="320"></iframe></div>';
return $channel;
}
Thanks in advance