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!

Community
  • 1
  • 1
user1015214
  • 2,421
  • 10
  • 33
  • 58
  • 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) – Kevin B Sep 06 '12 at 21:40
  • That did it! Thanks! you can post this as an answer. – user1015214 Sep 06 '12 at 21:42

2 Answers2

2

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

$(window.opener.document).find(...
Kevin B
  • 94,164
  • 15
  • 164
  • 175
0

window.opener.document makes the difference.

Try this:

var events = $(window.opener.document).find("tr.athletics-date");
var events_length = events.length;
Oscar Jara
  • 13,805
  • 10
  • 60
  • 93