Live Chat Icon For mobile
Live Chat Icon

How to get the changed value in Input Text?

Platform: Blazor| Category: Forms and validation

Use input change event to get the changed value in onchange event argument. If you bind using the two-way bind to value property, it will automatically change the value into the value property.

<input placeholder="Enter your text" @onchange="@onChange" />

@code {

    private string value { get; set; }
    private void onChange(Microsoft.AspNetCore.Components.ChangeEventArgs args)
    {
        value = (string)args.Value;
    }
}

Or

<input placeholder="Enter your text" @bind-value="@value" />

@code {

    private string value { get; set; }
}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.