Amalmax
11 months ago

why did not work js file in laravel 5.6?

Posted 11 months ago by Amalmax

working with laravel 5.6 and I have following sidemenu bar blade file,

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">


 <div class="list-group">
   
    <a href="#" class="list-group-item active"><i class="fa fa-key"></i> <span>App Settings</span></a>
    <a href="{{route('vehicles.myads')}}" class="list-group-item" ><i class="fa fa-credit-card"></i> <span>My Ads</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-question-circle"></i> <span>Support</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-arrow-circle-o-left"></i> <span>Sandbox Account</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-book"></i> <span>QuickStart Overview</span></a>
    <a href="#" class="list-group-item"><i class="fa fa-compass"></i> <span>Documentation</span></a>


  </div>

and css file,

.list-group {
     
     margin:auto;
     float:left;
     padding-top:20px;
    }
    .lead {
     
     margin:auto;
     left:0;
     right:0;
     padding-top:10%;
    }

and js file,

$(document).ready(function() {
  

  $('.list-group-item').click(function(e) {
    e.preventDefault();
    $('.list-group-item').removeClass('active');
    $(this).addClass('active');
  });
});

above js file is using highlight current page, and above codes using in my blade file as following,

@extends('layouts.app')
<script src="{{ url('/js/sidebar.js') }}"></script>
@section('head')
     
    <link rel="stylesheet" href="{{ asset('css/sidebar.css') }}">
@endsection
@section('content')
<div class="container"> 
    <div class="row">
    @include('_includes.nav.sidebar') 
        <div class="col-md-5 col-md-offset-1">
            @include('layouts.partials.alerts') 
@forelse( $vehicles as $vehicule )
           @if( $vehicule->uploads->count() > 0 )
                        <a href="{{ route('vehicles.show', $vehicule->id) }}">
                            @php
                                $upload = $vehicule->uploads->sortByDesc('id')->first();
                            @endphp
                            <img src="/images/{{ $upload->resized_name }}"></a>
                            {{$vehicule->provincename}}
                          {{$vehicule->milage}}
<br>
                            
<td><a class="button is-outlined" href="{{route('vehicles.edit',$vehicule->id.'/edit/')}}" >Edit</a></td>
                            <td><a class="button is-outlined" href="/myads/{{$vehicule->id}}/delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>
                        </a> 
                    <hr>
                    @endif
               
            @empty
                <td>No Advertisment to display.</td>
            @endforelse
</div>

</div>
</div>
@endsection

but in my above file it is not highlight current blade file, what is the wrong, how can fix this?

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