简体   繁体   中英

I don't know what I'm doing wrong but my .html with js and css won't show what is has to show

my html code does not show eg the selectpicker and I don't know what I'm doing wrong. I think there's some silly mistake but I can't find it. I am using laravel and followed this guide but it simply won't work. The bar charts work fine. I tried simple things like switching the button class to danger but it doesn't work.

 <!doctype html> <html lang="{{ config('app.locale') }}"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Laravel</title> <!-- Fonts --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.3/js/bootstrap-select.min.js" charset="utf-8"></script> <link href="{{asset('css/app.css')}}" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.3/css/bootstrap-select.min.css"> </head> <body> <div class="container"> <br /> <form action="{{url('stock/add')}}" method="post"> {{ csrf_field() }} <div class="form-group"> <label for="stockName">Stock Name:</label> <input type="text" class="form-control" id="stockName" name="stockName"> </div> <div class="form-group"> <label for="stockPrice">Stock Price:</label> <input type="text" class="form-control" id="stockPrice" name="stockPrice"> </div> <div class="form-group"> <label for="stockPrice">Stock Year:</label> <select class="selectpicker" name="stockYear"> <option value="1991">1991</option> <option value="1992">1992</option> <option value="1993">1993</option> <option value="1994">1994</option> <option value="1995">1995</option> <option value="1996">1996</option> </select> </div> <button type="submit" class="btn btn-primary">Submit</button> </form> </div> </body> </html>

try this:

       <label for="stockYear">Stock Year:</label>
       <select name="stockYear" id="stockYear">
          <option value="1991">1991</option>
          <option value="1992">1992</option>
          <option value="1993">1993</option>
          <option value="1994">1994</option>
          <option value="1995">1995</option>
          <option value="1996">1996</option>
      </select>

please pay attention to label "name". That is "stockYear" not "stockPrice".

The answer is that I (or the original author) used the wrong stylesheet (or maybe this error occurs because some time passed and something changed).

Instead of <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.3/css/bootstrap-select.min.css">
I had to use
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
After that change everything worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM