# Events

The Telerik UI for ASP.NET MVC OTPInput exposes a [Change](https://www.telerik.com/aspnet-mvc/documentation/api/kendo.mvc.ui.fluent/otpinputbuilder#eventssystemaction) event that allows you to control and customize the behavior of the UI component.

For a complete example on the basic OTPInput event, refer to the [demo on using the events of the OTPInput](https://demos.telerik.com/aspnet-mvc/otpinput/events).

## Handling by Handler Name

The following example demonstrates how to subscribe to events by handler name.

```Razor HtmlHelper
    @(Html.Kendo().OTPInput()
        .Name("otp")
        .Items(5)
        .Events(e => e.Change("onChange"))
    )
```

```JavaScript
    <script>
        function onChange() {
            // Handle the change event.
        }
    </script>
```

## Handling by Template Delegate

The following example demonstrates how to subscribe to events by using a template delegate.

```Razor HtmlHelper
    @(Html.Kendo().OTPInput()
        .Name("otp")
        .Items(5)
        .Events(e => e
            .Change(@<text>
                function() {
                    // Handle the change event inline.
                }
            </text>)
        )
    )
```

## Next Steps

* [Using the OTPInput Events (Demo)](https://demos.telerik.com/aspnet-mvc/otpinput/events)

## See Also

* [Using the API of the OTPInput for ASP.NET MVC (Demo)](https://demos.telerik.com/aspnet-mvc/otpinput/api)

* [Server-Side API of the OTPInput HtmlHelper](https://www.telerik.com/aspnet-mvc/documentation/api/otpinput)

* [Client-Side API of the OTPInput](https://docs.telerik.com/kendo-ui/api/ui/otpinput)
