How do I check the checkbox based on the text entered in the textbox?

Platform: Blazor| Category: Forms and validation

To check the checkbox, use the textbox input event to get the entered text, and based on the text enable or disable it. In the following example, if the entered text is “check”, using the @bind attribute you can enable the checkbox.

<input @oninput="@((args) => { this.isCheck = ((string)args.Value == "check") ? true : false; })" />

<br />

<input type="checkbox" @bind="@this.isCheck" />

@code {

    private bool isCheck { get; set; }

}

Share with

Related FAQs

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

Please submit your question and answer.