title: How to set the focus to an InputText element?
body: <p>Using the <a href="https://docs.microsoft.com/de-de/aspnet/core/blazor/javascript-interop?view=aspnetcore-3.0#capture-references-to-elements" rel="noreferrer">example from the Microsoft docs</a>, I'm trying to programmatically set the focus to an input element.</p>
  <p>Unfortunately, the example uses a standard <code>&lt;input type=&quot;text&quot;&gt;</code> whereas I want to use it for an <a href="https://docs.microsoft.com/de-de/aspnet/core/blazor/forms-validation?view=aspnetcore-3.0" rel="noreferrer"><code>InputText</code> element</a>.</p>
  <p>The Microsoft example uses an extensions method that takes an <code>ElementReference</code>:</p>
  <pre class="lang-cs prettyprint-override"><code>public static Task Focus(this ElementReference elementRef, IJSRuntime jsRuntime)
  {
      return jsRuntime.InvokeAsync&lt;object&gt;(
          &quot;exampleJsFunctions.focusElement&quot;, 
          elementRef);
  }
  </code></pre>
  <p>Using an <code>InputText</code>, I see no way of obtaining such an <code>ElementReference</code>.</p>
  <p>Providing my own <code>Focus()</code> overload with an <code>InputText</code> instead, compiled but showed no visual result. Therefore I'm clueless.</p>
  <h3>My question</h3>
  <p>How can I programmatically set the focus to an <code>InputText</code> element?</p>