title: How to do client-side UI events in Blazor
body: <p>I just started playing around with Blazor and I can already see the great potential of this new framework.</p>
  
  <p>I'm wondering, though, how it will handle doing simple things like setting focus on an input control? For instance, after I handle a click event, I want to set the focus to a text input control. Do I have to use JQuery for something like that, or will Blazor have some built-in methods for that sort of thing?</p>
  
  <p>Thanks</p>
  
  <p><strong>Update: I posted an answer below with an example of how to set the focus to a control by invoking a JavaScript function from the .Net code.</strong></p>
  
  <p>As of right now (Blazor 0.9.0) you create your JavaScript functions in the Index.html (or reference them from Index.html) and then in your Blazor page or component you call JsRuntime.InvokeAsync("functionName", parms);</p>
  
  <p><a href="https://docs.microsoft.com/en-us/aspnet/core/razor-components/javascript-interop" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/razor-components/javascript-interop</a></p>