Here is my jQuery code:
$('body').append('<div id="popupContact"><a id="popupContactClose">close</a><br/><iframe src="http://google.com"></iframe></div><div id="backgroundPopup"></div>');
I tested it at this site.
It worked but I have a problem. I think that the site has many iframes, so I want to find the first body of the combined page. I tried this code.
$('body')[0].append('<div id="popupContact"><a id="popupContactClose">close</a><br/><iframe src="http://google.com/" id = myFrame></iframe></div><div id="backgroundPopup"></div>');
But unfortunately it doesn’t work.
I want to apply the rule only to the first body tag.
How can I solve this?
You could try
$('body:first'). See http://api.jquery.com/first-selector for details.