Skip to content

@bind:event not working on input element #10893

Closed
dotnet/razor
#687
@SteveSandersonMS

Description

@SteveSandersonMS

I thought the following would work:

<input @bind="@someText" @bind:event="oninput" />

... but it does not (it only updates on change, not on input).

To update on each keystroke, you have to use the following less obvious syntax instead:

<input @bind-value="@someText" @bind-value:event="oninput" />

Also I think we should dropon from these event names, as it feels less obvious than @bind:event="input". The on prefix is a bit of a historical oddity in HTML/JS generally, e.g., more recent APIs like addEventListener don't use on prefixes for event types.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions