This library provides a set of handy extension methods to IJSRuntime
, that makes it easy to make perform ad-hoc calls to JavaScript methods on DOM elements or the window
or the document
object. It also makes it easy to read and set properties on a DOM element and the window
or the document
object.
To invoke a method on a DOM element, that you have a reference to via an ElementReference
, use InvokeOn
or InvokeOn<T>
, if you need a return value.
- Add the package to your Blazor WebAssembly or Blazor Server project via Nuget.
- Include
<script src="_content/BlazorJSInteropExtensions/blazorJsInteropExtensions.js"></script>
in your index.html or _Host.cshtml.