aWebDeveloper
aWebDeveloper

Reputation: 38332

Empty contents of a iframe without touching the src

I would like to Empty contents of a iframe without touching the src. Probably using jquery. Say some thing like setting the innerHTML of body inside iframe to &nbsp

I have tried the following and it didnt work

$("#Top iframe body").html(' ');

Upvotes: 0

Views: 257

Answers (1)

Pekka
Pekka

Reputation: 449385

If the iframe is on a different domain, its contents are off-limits to your page. There's nothing you can do about that - except remove or hide the whole container... or change the src.

If it is on the same domain, you can do it but the syntax is different - use .contents().

Upvotes: 1

Related Questions