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

Time:07-16

my html code does not show e.g. 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 >
          <br />
          <form action="{{url('stock/add')}}" method="post">
            {{ csrf_field() }}
            <div >
               <label for="stockName">Stock Name:</label>
               <input type="text"  id="stockName" name="stockName">
             </div>
             <div >
               <label for="stockPrice">Stock Price:</label>
               <input type="text"  id="stockPrice" name="stockPrice">
             </div>
             <div >
               <label for="stockPrice">Stock Year:</label>
               <select  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" >Submit</button>
          </form>
        </div>
    </body>
</html>

CodePudding user response:

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".

CodePudding user response:

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/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
After that change everything worked fine.

  • Related