Using jQuery trigger for click event on parent win

2019-06-18 04:28发布

问题:

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.....

回答1:

try:

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


回答2:

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)


标签: jquery click