Home > Article > Web Front-end > js triggers select onchange event code_javascript skills
The onchange event of select or text needs to be triggered manually (via keyboard input) by changing the value of select or text. If you assign a value to select or text in js, the onchang event cannot be triggered.
For example, after the page is loaded, you need To trigger an onChange event, use document.getElementById("province").value="Hubei" in js; it is not possible to directly assign a value to select or text. If you want to manually trigger the onchange event, you need to assign a value to select in js. Add the following statement
document.getElementById("province").fireEvent('onchange') to implement,