element.click() fires a bubbling click event and runs the element's default action (a checkbox toggles, a link navigates), but does nothing on a disabled element.
document.querySelector("#accept").click(); // fires click, ticks the checkbox
uploadButton.addEventListener("click", () => fileInput.click()); // styled file pickerThe event's isTrusted is false, so handlers can tell script clicks from real ones. Dispatching Events fires other event types.