blazorsliderblazor-server-sideslideshowblazor-webassembly

Slider does not change values In Blazor


I'm trying to get a slider in Blazor to the budget parameter, but when one moves the slider then the budget value doesn't change. Why is that, and how could I fix it?

Here is the component code I'm using the IJSRuntime to use js fonctions, and here what I got.


Solution

  • Have you considered simplifying it to something like this. No JS, no hoops : you are using Blazor, not a JS framework. You can apply whatever CSS framework you want to polish it.

    @page "/"
    
    <PageTitle>Index</PageTitle>
    
    <div>
        <label>Daily Budget</label>
        <input class="mx-3" type="range" min="@_min" max="@_max" @bind=_budget @bind:event="oninput"/>
        <span class="ms-4">$@_budget:00</span>
    </div>
    
    @code{
        private int _min = 0;
        private int _max = 1000;
        private int _budget;
    }
    

    enter image description here