PSR
PSR

Reputation: 40318

Using jQuery trigger for click event on parent window element by class name

I am using

$(".abc",window.opener.document).trigger('click')

To trigger click event on parent window element.

But it is not working.An element exist in the parent window with class name abc.

How i can trigger onclick event ?

Thanks in advance.....

Upvotes: 8

Views: 10615

Answers (2)

Rohan Kumar
Rohan Kumar

Reputation: 40639

Use the context-parameter

$(".abc",parent.document)

But if you really use a popup, you need to access opener instead of parent

$(".abc",opener.document)

Upvotes: 1

geevee
geevee

Reputation: 5451

try:

window.opener.$('.abc').trigger('click') 

Upvotes: 10

Related Questions