0

Possible Duplicate:
how to access parent window object using jquery?

I have the following jquery code

var events = $(window.opener).find("tr.athletics-date");
        var events_length = events.length;

I'm trying to retrieve all of the tr tags with class athletics-date from the parent page (which opened up the present new page) and its not working. The class name is correct, what am I doing wrong? events_lenth came up as 0!

2
  • i believe you want window.opener.document since window.opener gets you the parent window, not parent document. Not 100% sure though (otherwise i would make this an answer) Commented Sep 6, 2012 at 21:40
  • That did it! Thanks! you can post this as an answer. Commented Sep 6, 2012 at 21:42

2 Answers 2

2

window.opener gives you the window object, you want the document object.

$(window.opener.document).find(...
Sign up to request clarification or add additional context in comments.

Comments

0

window.opener.document makes the difference.

Try this:

var events = $(window.opener.document).find("tr.athletics-date");
var events_length = events.length;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.