Question

I have the following jquery sentence in my program:

$("#(parent.frames[2].id)").html (Content);

In frame 2 there is a string variable called id which holds the id of the element I want to change. What I want to do is to replace all the html of this id with the string Content.

The console is actually outputing a syntax error Error: Syntax error, unrecognized expression: #(parent.frames[2].id). What should be the correct syntax?

Was it helpful?

Solution

Your selector is invalid. I assume you mean the .parent object of window.

Try this instead

$("#"+parent.frames[2].id).html(Content);

OTHER TIPS

I finally implemented it with javascript:

parent.frames[2].document.getElementById(parent.frames[2].id).innerHTML = Content;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top