All the methods I have seen in blazor wasm to inject Javascript involves calling a javascript function. what if I want to inject a dynamic javascript function block.
Example: await JS.InvokeVoidAsync("<script>alert('A')</script",null);
Is this possible? "InvokeAsync" only seems to accept a function name.
>Solution :
Try it like this call the function name and then pass the data as an argument, as you’re directly invoking JS, the script tag is unnecessary
await JSRuntime.InvokeVoidAsync("alert", "Hello!");