js onchange event. Change event handler or source

The OnChange handler is called when any input field changes or any button is clicked.

The Name argument contains the name of the input field or button in lower case.

Example: Procedure OnChange(Name: String); Begin // If the price or quantity fields are changed, then calculate the amount If Name="price" Or Name="cnt" Then Summa:= RoundMul(Price, Cnt, 2); // If the amount field is changed, then we calculate the price. If Name="summa" Then Price:= If(Cnt=0, 0, RoundDiv(Summa, Cnt, 2)); end;

A similar effect can be obtained when using the OnPriceChange, OnCntChange, OnSummaChange handlers.

Example: Procedure OnPriceChange; Begin Summa:= RoundMul(Price, Cnt, 2); end; On ProcedureCntChange; Begin Summa:= RoundMul(Price, Cnt, 2); end; On ProcedureSummaChange; Begin Price:= If(Cnt=0, 0, RoundDiv(Summa, Cnt, 2)); end;

This handler is convenient to use when organizing modularity, since it collects information about almost all events. For example:

BaseClass: Variant; On ProcedureCreate; Begin BaseDocument.Init(Self); // Create a base class and exchange links with it. Document initialization. end; On ProcedureChange(Name: String); Begin BaseClass.OnChange(Name); // Passing events to the base class end;

Or an example of modularity using a singleton (module property on the editor's Description tab):

On ProcedureCreate; Begin BaseClass.OnCreate(Self); // Document initialization. end; On ProcedureChange(Name: String); Begin BaseClass.OnChange(Self, Name); // Passing events to the base class. end;

jQuery method .change() binds JavaScript event handler "change"(element change), or fires this event on the selected element. The method is used with HTML elements forms.

Event select fires when the value of a form element changes (elements ,

In this example using jQuery method .change() we click on the element