How to trigger the onchange event of TextBox control through code in JS code mode, after checking the data, find JS provides a method, can trigger the control should be all events
The onchange event in JS is an event that changes the value of the input control at the client, such as a TextBox. However, if you change the value of a textbox in the JS code, instead of changing a TextBox value via keyboard input, you will not start onchange events. Then, how in the JS code mode to trigger the TextBox control onchange event, after consulting data, found that JS provides a method, can trigger the control should be all events. The Object.fireevent () method, which uses methods such as Object.fireevent (' onchange '), triggers the control's onchange event. Similarly, using the FireEvent method in JS can also trigger other space events. • Add that the above FireEvent method is not supported in Firefox browsers, so 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 determine whether the FireEvent event is available or not, use the onchange () method directly.