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

268
Views
How to simulate typing and change input value in Chrome extension content script

I need a way to change the value of the input field with my new value

I tried input.value didn't work. Tried this function:

  function simulateTyping(element, value, i) {
    i === 0 && element.setAttribute("value", value);
    i === 0 && (element.value = "");

    if (i < value.length) {
      element.value += value.charAt(i);
      element.dispatchEvent(
        new Event("textInput", {
          data: value.charAt(i),
          inputType: "textInput",
          bubbles: true,
          cancelable: true,
        })
      );
      element.dispatchEvent(
        new Event("input", {
          bubbles: true,
          data: value.charAt(i),
          cancelable: true,
        })
      );
      setTimeout(simulateTyping.bind(this, element, value, i + 1), 10);
    } else {
      element.dispatchEvent(
        new Event("change", {
          bubbles: true,
          cancelable: true,
        })
      );
      element.dispatchEvent(new Event("blur", { bubbles: true }));
      var evt = document.createEvent("KeyboardEvent");
      evt.initEvent("keyup", true, true);
      element.dispatchEvent(evt);
    }
  }

This function changed the value but suddenly the website is changing the value but If I type the number with my keyboard the website didn't change the value .

I think there is something more which we need to find to actually simulate real keypress This is the website https://tibiablackjack.com/crash

Video demo https://www.loom.com/share/cb568c04ac85427395c2f0e1481c7fb9

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!