Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
Mousedown is not triggering from a checkbox in modal popup to an outside popup button

The modal popup is a drupal dialogbox which is coming inside an iframe. I need to trigger mousedown on a submit button which is outside iframe when checkboxes are clicked in popup. I wrote the below jquery, but the button is not affecting.

$('#modal-popup .form-boolean--type-checkbox').click(() => {
   let body = $(window.parent.document.body);
   console.log(body);         
   body.find('[name="add_more_button"]').mousedown();
});

$(window.parent.document.body).find('[name="add_more_button"]').mousedown(); works in the console but not from jQuery. Why is this?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I got the solution after hours of research. From iframe we can call a function of parent window. I used below code and working fine.

$('#modal-popup .form-boolean--type-checkbox').click(() => {
    window.parent.parentFunction();
 });

 window.parentFunction = function(){
   $('[name="add_more_button"]').mousedown();
 }

I used separate function for triggering the button and used window.FuntionName name for this. From iframe popup, I called this function to trigger mousedown using window.parent.FunctionName()

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!