Yeah, you are right, I had it as id before when testing it, but had
tried name also. Sorry that I didn't realize that.
Thanks for posting, I will try this and see how it works!
On Apr 21, 2:19 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote:
> I noticed you wanted to assign an ID, but were using the name property. Try
> this:
>
> $(document).ready(function(){
> $("iframe").attr('id','frame1');
>
> });
>
> As regards to the HTML, you need to get the contents of the iframe. This
> will return the document element. You can then do this:
>
> $('iframe:first').contents()[0].documentElement.innerHTML
>
> JK
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
>
> Behalf Of hubbs
> Sent: Monday, April 21, 2008 1:41 PM
> To: jQuery (English)
> Subject: [jQuery] Targeting iframes, adding id, and getting content
>
> Here is my problem.
>
> There are 2 iframes on my page, that I need to assign an ID to, and
> then I need to get the innerHTML from each. For some reason, I can't
> get jquery to add an id to the iframe at all. I tested it using div,
> and that worked fine. Can you not set an id for an iframe?
>
> $(document).ready(function(){
> $("iframe").attr({
> name: "frame1"
> });
> });
>
> That is not seeming to work. Any ideas?
>
> Then I was trying to get the inner html of the iframe, but I am
> stumped on that too:
>
> var summarytext = $("iframe:first").html();