@page "/" @inject IJSRuntime JsRuntime; <p> <label for="spinner">Select a value:</label> <input id="spinner" name="value"> </p> <p> <button id="disable" @onclick="@( ()=>JustCall("dissableclick") )" >Toggle disable/enable</button> <button id="destroy" @onclick="@( ()=>JustCall("destroyclick") )" >Toggle widget</button> </p> <p> <button id="getvalue" @onclick="@( ()=>JustCall("getvalueclick") )" >Get value</button> <button id="setvalue" @onclick="@( ()=>JustCall("setvalueclick") )" >Set value to 5</button> </p> @code { protected async override Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { await JsRuntime.InvokeAsync<object>("myWrapperKSUIfunctions.initialize"); } } protected async Task JustCall(string f) => await JsRuntime.InvokeAsync<object>($"myWrapperKSUIfunctions.{f}"); }
namespace BlazorFiddleProject { using Microsoft.AspNetCore.Components.Builder; using Microsoft.Extensions.DependencyInjection; public class Startup { public void ConfigureServices(IServiceCollection services) { } public void Configure(IComponentsApplicationBuilder app) { app.AddComponent<App>("app"); } } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width"> <title>BlazorFiddleProject</title> <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <style> app { } </style> <script type="text/javascript"> </script> </head> <body> <app>Loading...</app> <script src="_framework/blazor.webassembly.js"></script> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> var spinner = null; window.myWrapperKSUIfunctions = { initialize: function () { spinner = $( "#spinner" ).spinner(); $( "button" ).button(); }, dissableclick: function () { if ( spinner.spinner( "option", "disabled" ) ) { spinner.spinner( "enable" ); } else { spinner.spinner( "disable" ); } }, destroyclick: function () { if ( spinner.spinner( "instance" ) ) { spinner.spinner( "destroy" ); } else { spinner.spinner(); } }, getvalueclick: function () { alert( spinner.spinner( "value" ) ); }, setvalueclick: function () { spinner.spinner( "value", 5 ); }, }; </script> </body> </html>

Add component

BlazorFiddle was updated from Blazor 0.7 to .NET 6.0. Your old source code could not work. You need to upgrade to latest.