tags:

views:

83

answers:

1

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?

Thanks in advance

+1  A: 

If you just want to load a 'bunch of HTML' you could just use the jQuery load function

$("#my_div").load("content.html");

Keep in mind that you can't 'read' from an iframe if the iframe is on another domain. Just as you can't use AJAX to fetch HTML from another domain.

Gate