Try this: $("<li />", opener.document)
That way it will create the li element in the right document. http://docs.jquery.com/Core/jQuery#htmlownerDocument
Try this: $("<li />", opener.document)
That way it will create the li element in the right document. http://docs.jquery.com/Core/jQuery#htmlownerDocument