softDeveloper 0 Junior Poster in Training

HI all,

I want to get the contents of an iframe with jquery doing this code

for(var i=0;frames.length;i++){

			if(self.parent.frames[i].getSelection().toString()!=""){

var bdy = $(self.parent.frames[i].name).contents().find("body"); 
				alert('iframe:'+ bdy.html());
}

}

Is there a better way of doing this?

My goal is getting the iframes selection create a range, extracting its contents, then to create a map element with the selection contents as innerHTML, and insert the node replacing the selection. I can do this with javascript using chrome, but not with ie, so i'm trying to do this with jquery in order for his to work with all browsers.

Then I want to do the reverse. Get all map elements in the iframes, replacing the map outerHTML with its innerHTML using jquery.

Thanks in advance,

Regards