Laravel Livewire change Jquery class name inside component

Viewed 37

Here i have a component which i want to change jquery class/id name, all of my jquery codes into <script> tag don't update after change class/id names

for example:

class OrderFormComponent extends Component
{
    public string $current_span = '';

    public function render()
    {
        return view('livewire.front.order-form-component');
    }
}

view:

    @push('scripts')
        <script>
            $("{{$current_span}}").removeClass("active-process");
            

            $("#section-2").on("click", ".next-level-2", function (e) {
               @this.set('current_span', '#pstep-1>span');
            });
        </script>
    @endpush
</div>

here i want to change current_span variable to #pstep-1>span by clicking on #section-2 and use that in $("{{$current_span}}").removeClass("active-process");

when i put $("{{$current_span}}").removeClass("active-process"); outside of script it work fine

0 Answers
Related