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

222
Views
Change event doesn't work in console (Safari and Chrome) on some sites

I've been working on automation of user events for some stores but got stuck on cart page for https://shop.advanceautoparts.com/. I've been trying to fire any possible event on input field but it doesn't do same as user inputing data manually. Change event is detected on input but is there any additional events that making "Apply" button usable?

I've been trying with both jQuery and vanilla JS but nothing seems to work.

$(document).ready(function() {
    $('input[name="promoCode"]').blur();
     $('input[name="promoCode"]').focus(); 
    $('input[name="promoCode"]').attr('value','Example')[0].dispatchEvent(new Event('change', { bubbles: true }));
    $('input[name="promoCode"]').val('Example1')[0].dispatchEvent(new Event('change', { bubbles: true }));
    $('input[name="promoCode"]').blur();
          setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').get(0).dispatchEvent(new MouseEvent('click', { view: window, bubbles: true, cancelable: true }))
          }, 100);
    setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').get(0).dispatchEvent(new MouseEvent('mousedown', { view: window, bubbles: true, cancelable: true }))
          }, 200);
    setTimeout( function () { 
    $('button[aria-label="Apply"]').removeAttr('disabled');
            $('button[aria-label="Apply"]').click();
          }, 300);
 });

The click Event shouldn't be the issue as when I input something maually and fire

$('button[aria-label="Apply"]').click();

then everything is processing normally. Any idea?

about 4 years ago · Juan Pablo Isaza
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!