5 months ago

@push and @stack don't seem to load javascript

Posted 5 months ago by AdRock

I have come back to using Laravel after a long break and am now using 5.8

I have created my template and included views etc but I've got a problem loading jQuery plugins.

I've tested to make sure jQuery is loaded and it is but any plugins I load using @push don't appear to load although I can see them in the source and console.

They must be loading as the reports.js file is kicking up a stink about

Uncaught TypeError: $(...).SumoSelect is not a function

When I run a test to see if any of the plugins are loaded, the console says none of them are.

This is my main template

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('', 'Laravel') }}</title>

    <!-- Scripts -->
    <script src="{{ asset('js/app.js') }}" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//">
    <link href="" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <link href="{{ asset('css/app.css') }}" rel="stylesheet">
    <!-- push target to head -->
    <div id="app">
    <script src=""></script>
    <!-- or push target to footer -->

This is my view which causes the problem



<link href="{{ asset('libraries/sumoselect/css/sumoselect.css') }}" rel="stylesheet" media="screen">
<link href="{{ asset('libraries/flatpickr/css/flatpickr.min.css') }}" rel="stylesheet" media="screen">

<script src="{{ asset('libraries/sumoselect/js/jquery.sumoselect.min.js') }}"></script>
<script src="{{ asset('libraries/chartjs/js/Chart.min.js') }}"></script>
<script src="{{ asset('libraries/flatpickr/js/flatpickr.js') }}"></script>

<script src="{{ asset('js/reports/reports.js') }}"></script>

and finally this is my reports.js

$('#report-types, #base-chart-types').SumoSelect({ 
        okCancelInMulti: true ,
        triggerChangeCombined: false,
        isClickAwayOk: true,
        selectAll: true,
        forceCustomRendering: true

Please sign in or create an account to participate in this conversation.