Using the example from the Microsoft docs, I'm trying to programmatically set the focus to an input element.
Unfortunately, the example uses a standard <input type="text"> whereas I want to use it for an InputText element.
The Microsoft example uses an extensions method that takes an ElementReference:
public static Task Focus(this ElementReference elementRef, IJSRuntime jsRuntime){ return jsRuntime.InvokeAsync<object>("exampleJsFunctions.focusElement", elementRef);}Using an InputText, I see no way of obtaining such an ElementReference.
Providing my own Focus() overload with an InputText instead, compiled but showed no visual result. Therefore I'm clueless.
My question
How can I programmatically set the focus to an InputText element?