-1

I cant seem to load any of my files in the href part of the dropdown menu. I am trying to load the files dynamically in the .where-you-tune class. I don't know what I am doing wrong because I keep getting

(index):81 Uncaught TypeError: $(...).load is not a function

I have excluded some of the bootstrap code because it is not necessary

<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
  <div class="container-fluid">
    <a class="navbar-brand" href="#">Scooters Tuner</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarResponsive">

      <div class="dropdown">
        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Tuning Type
        </button>
        <div class="dropdown-menu tuning-selection" aria-labelledby="dropdownMenuButton">
          <a class="dropdown-item tuning-selection" id="guitar_standard" href="tunings/guitar_standard.html">Guitar(Standard)</a>
          <a class="dropdown-item tuning-selection" id="guitar_drop_d" href="tunings/guitar_drop_d.html">Guitar(Drop D) </a>
          <a class="dropdown-item tuning-selection" id="bass_standard" href="tunings/bass_standard.html">Bass Standard</a>
          <a class="dropdown-item tuning-selection" id="mandolin_standard" href="tunings/mandolin_standard.html">Mandolin</a>

        </div>
      </div>

      <ul class="navbar-nav ml-auto">
        <li class="nav-item active">
          <a class="nav-link" href="#">About
            <span class="sr-only">(current)</span>
          </a>
        </li>
      </ul>

    </div>
  </div>
</nav>

<!-- Page Content -->
<div class="container">
  <div class="row">
    <div class="col-lg-12">
      <div class="where-you-tune">


      </div>
    </div>
  </div>
</div>

<!-- Bootsrap Core JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script type="text/javascript">

Part I am having trouble with

$(document).ready(function(){
    $('a.tuning-selection').click(function(e){
        e.preventDefault();
        $('.where-you-tune').load($(this).attr('href'));
    });
});
Don't Panic
  • 13,965
  • 5
  • 32
  • 51
  • 5
    Possible duplicate of [How to change the href for a hyperlink using jQuery](https://stackoverflow.com/questions/179713/how-to-change-the-href-for-a-hyperlink-using-jquery) – S4NDM4N Oct 19 '17 at 03:54
  • The duplicate doesn't seem to match the question. – StackSlave Oct 19 '17 at 04:26

1 Answers1

0

The code you've shown includes 2 versions of jQuery. They are conflicting, and causing your jQuery not to work at all.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>

The jQuery slim distribution is an alternative, not something to be used as well as the main distro.

Remove one of them, and your code works fine - I've verified this locally.

Don't Panic
  • 13,965
  • 5
  • 32
  • 51