Using jQuery trigger for click event in window parent by class name

I use

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

To trigger the click event on the parent of a window.

But it does not work. The item exists in the parent window with the class name abc .

How can I fire the onclick event?

Thanks in advance.

+6
source share
2 answers

to try:

 window.opener.$('.abc').trigger('click') 
+8
source

Use the context parameter

 $(".abc",parent.document) 

But if you really use the popup , you need to open the opener instead of parent

 $(".abc",opener.document) 
0
source

Source: https://habr.com/ru/post/956145/


All Articles