Skip to content

[Components] OnChange and OnInput do not get the value #8587

@xclud

Description

@xclud

I am trying on get oninput or onchange handlers working with contenteditable. My code is as below:

<p contenteditable="true" oninput="@HandleChange" onchange="@HandleChange">@Text</p>

@functions{
    [Parameter] string Text{get;set;}

    void HandleChange(UIChangeEventArgs e)
    {
        Console.WriteLine(e.Type + " " + e.Value);
    }
}

In above code e.Value is always null.

I should note that it works well with input and bind. But i need this to work for a p and div. I need the value as string, however it would be nice to get the value as html (innerHTML) as well.

Any solution, please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor Components

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions