I am currently developing a Chrome extension that automatically submits a form to the server. I know that there is a function on the page that will allow me to submit the form. I tested using the Chrome console and made sure that it works, but a problem occurred. The Javascript function gets executed before being defined, resulting in an UnknownReferenceError, and the form can't be submitted.

I tried using jQuery's on("load") and setTimeout functions, but neither worked properly. jQuery won't log the message.

$(window).on("load", function() {
  console.log("submitted the form successfully");

1 Answers

Community On
window.onload = function () { alert("Page is loaded.") }