In js Code mode, how does one trigger the onchange event of the textbox Control through code? after reading the materials, it is found that js provides a method, the onchange event in all event js triggers the control to change the value of the input control on the client side, such as a textbox, which will trigger an event. However, if you change the value of a textbox In the js Code, instead of entering a textbox value through the keyboard, the onchange event will not be initiated.
In the js Code mode, how does one trigger the onchange event of the textbox Control through code? after reading the information, it is found that js provides a method to trigger all events of the control. The object. fireEvent () method, such as object. fireEvent ('onchange'), can trigger the onchange event of the control.
Similarly, using the fireEvent method in js can also trigger other spatial events.
• AddThe above fireEvent method is not supported in the firefox browser. If you want to run both ie and ff, try the following code.
The Code is as follows:
If (obj. fireEvent)
{
Obj. fireEvent ('onchange ');
}
Else
{
Obj. onchange ();
}
That is to say, determine whether the fireEvent event is available. If it is unavailable, use the onchange () method directly.