Uncaught TypeError when clicking on navigation buttons

Uncaught TypeError when clicking on navigation buttons

Hi, 

I have the code below that is relative to a page that has a multi-step form. For the navigation between the steps I'm using bootstrap and jquery. The issue is that when some step navigation button is clicked it appears on the console the error:

Uncaught TypeError: Cannot read property 'nodeName' of undefined in the  tabs.js file in the line 155 that is:
  1.       if (container.nodeName === 'UL') { // line 155
Do you know where can be the issue? 

HTML:

  1. <div class="bg-light-gray2">
  2.   <div class="container nopadding py-4">
  3.     <div class="row justify-content-center align-items-center">
  4.       <div class="col-12">
  5.         <h1 class="h5 text-center text-heading-blue font-weight-bold">Page Title</h1>
  6.       </div>
  7.     </div>

  8.     <div class="row mt-3 d-flex justify-content-center">
  9.       <div class="col-12">
  10.         <div class="registration_form">
  11.           <ul class="nav nav-pills bg-light-gray registration_form_list" role="tablist">
  12.             <li class="">
  13.               <a class="nav-link active" href="#step1" data-toggle="tab" role="tab">
  14.                 Step 1<br><small class="d-none d-md-inline-block">General Info</small></a>
  15.             </li>
  16.             <li class="disabled">
  17.               <a class="nav-link" href="#step2" data-toggle="tab" role="tab">
  18.                 Step 2<br><small class="d-none d-md-inline-block">Conference Creator Info</small></a>
  19.             </li>
  20.             <li class="disabled">
  21.               <a class="nav-link" href="#step3" data-toggle="tab" role="tab">
  22.                 Step 3<br><small class="d-none d-md-inline-block">Registration Types</small></a>
  23.             </li>
  24.           </ul>

  25.           <form method="post" name="test" class="clearfix" action="/conference/store">
  26.             <div class="tab-content registration_body bg-white" id="myTabContent">
  27.               <div class="tab-pane fade show active clearfix" id="step1" role="tabpanel" aria-labelledby="home-tab">
  28.                
  29.                 <div class="form-group">
  30.                   <label for="conference_name" class="text-heading h6 font-weight-semi-bold">Conference Name</label>
  31.                   <input type="text" required class="form-control" name="conference_name" id="conference_name">
  32.                 </div>

  33.                 <div class="form-row">
  34.                   <div class="form-group col-lg-6">
  35.                     <label for="conference_categories" class="text-heading h6 font-weight-semi-bold">Categories</label>
  36.                     <select id="tag_list"  multiple class="form-control" name="conference_categories" id="conference_categories">
  37.                       <option>category1</option>
  38.                       <option>category2</option>
  39.                     </select>
  40.                   </div>
  41.                 </div>

  42.                 <div class="form-group">
  43.                   <label class="text-heading h6 font-weight-semi-bold">Address</label>
  44.                   <div class="form-row">
  45.                     <div class="col">
  46.                       <input type="text" required name="conference_city" class="form-control">
  47.                     </div>
  48.                     <div class="col">
  49.                       <input type="text" required name="conference_zip_code" class="form-control">
  50.                     </div>
  51.                   </div>
  52.                 </div>

  53.                 <div class="form-row">
  54.                   <div class="form-group col">
  55.                     <input type="text" required name="conference_address" class="form-control">
  56.                   </div>
  57.                 </div>
  58.                 <div class="form-row">
  59.                   <div class="form-group col">
  60.                     <input type="text" required name="conference_place" class="form-control">
  61.                   </div>
  62.                 </div>

  63.                 <div class="form-row">
  64.                   <div class="form-group col col-lg-6">
  65.                     <label for="conference_image" class="text-heading h6 font-weight-semi-bold">Conference Image</label>
  66.                     <label class="conference_image">
  67.                       <input type="file" required id="conference_image" name="conference_image" class="custom-file-input">
  68.                       <span class="custom-file-control"></span>
  69.                     </label>
  70.                   </div>
  71.                 </div>


  72.                 <div class="form-group">
  73.                   <label for="textarea" class="text-heading h6 font-weight-semi-bold">Conference Description</label>
  74.                   <textarea class="form-control" name="conference_description" id="textarea" rows="3"></textarea>
  75.                 </div>

  76.                 <div class="float-right">
  77.                   <button type="button" href="#step2" data-toggle="tab" role="tab"
  78.                           class="btn mr-2 btn-primary btn next-step">
  79.                     Go To Step 2
  80.                   </button>
  81.                 </div>

  82.               </div>

  83.               <div class="tab-pane fade clearfix" id="step2" role="tabpanel" aria-labelledby="profile-tab">

  84.                 <div class="form-row">
  85.                   <div class="form-group col-md-6">
  86.                     <label for="conference_organizer_name"  class="text-heading h6 font-weight-semi-bold">Name</label>
  87.                     <input type="email" class="form-control" required name="conference_organizer_name" id="conference_organizer_name">
  88.                   </div>
  89.                   <div class="form-group col-md-6">
  90.                     <label for="conference_organizer_email"  class="text-heading h6 font-weight-semi-bold">Email</label>
  91.                     <input type="password" required name="conference_organizer_email" class="form-control" id="conference_organizer_email" placeholder="Email">
  92.                   </div>
  93.                 </div>

  94.                 <div class="form-group">
  95.                   <label for="conference_organizer_description" class="text-heading h6 font-weight-semi-bold">Description</label>
  96.                   <textarea name="organizer_description" id="conference_organizer_description" class="form-control" rows="3"></textarea>
  97.                 </div>

  98.                 <button type="button" href="#step1" data-toggle="tab" role="tab"
  99.                         class="btn mr-2 btn-outline-primary btn prev-step">
  100.                   Back to Step 1
  101.                 </button>
  102.                 <button type="button" href="#step2" data-toggle="tab" role="tab"
  103.                         class="btn mr-2 btn-primary btn next-step">
  104.                   Go To Step 2
  105.                 </button>
  106.               </div>
  107.               <div class="tab-pane clearfix fade" id="step3" role="tabpanel" aria-labelledby="contact-tab">
  108.                 <div class="form-group">
  109.                   <label for="registration_type_name" class="text-heading h6 font-weight-semi-bold">Registration Type Name</label>
  110.                   <input type="text" required class="form-control" name="registration_type_name" id="registration_type_name">
  111.                 </div>

  112.                 <div class="form-group">
  113.                   <label for="registration_type_description" class="text-heading h6 font-weight-semi-bold">Registration Type Description</label>
  114.                   <input type="text" class="form-control" name="registration_type_description" id="registration_type_description">
  115.                 </div>

  116.                 <div class="form-row">
  117.                   <div class="form-group col-md-6">
  118.                     <label for="registration_type_capacity" class="text-heading h6 font-weight-semi-bold">Capacity</label>
  119.                     <input type="text" required class="form-control" name="registration_type_capacity" id="registration_type_capacity">
  120.                   </div>
  121.                   <div class="form-group col-md-6">
  122.                     <label for="registration_type_value" class="text-heading h6 font-weight-semi-bold">Value</label>
  123.                     <input type="text" required class="form-control" name="registration_type_value" id="registration_type_value">
  124.                   </div>
  125.                 </div>

  126.                 <div class="form-row">
  127.                   <div class="form-group col-md-6">
  128.                     <label for="registration_type_minimum" class="text-heading h6 font-weight-semi-bold">Minimum Registrations per request</label>
  129.                     <input type="text" name="registration_type_minimum" class="form-control" id="registration_type_minimum" value="1">
  130.                   </div>
  131.                   <div class="form-group col-md-6">
  132.                     <label for="registration_type_maximum" class="text-heading h6 font-weight-semi-bold">Maximum Registrations per request</label>
  133.                     <input type="text" class="form-control" name="registration_type_maximum" id="registration_type_maximum">
  134.                   </div>
  135.                 </div>

  136.                 <div class="form-row">
  137.                   <div class="form-group col-md-6">
  138.                     <label for="registration_type_start" class="text-heading h6 font-weight-semi-bold">Start</label>
  139.                     <div class="input-group date" data-provide="datepicker">
  140.                       <input type='text' name="registration_type_start" class="form-control" id="registration_type_start" placeholder="MM/DD/YYY" />
  141.                     </div>
  142.                   </div>
  143.                   <div class="form-group col-md-6">
  144.                     <label for="registration_type_end" class="text-heading h6 font-weight-semi-bold">End</label>
  145.                     <div class="input-group date" data-provide="datepicker">
  146.                       <input type='text' class="form-control" name="registration_type_end" id='registration_type_end' placeholder="MM/DD/YYY" />
  147.                     </div>
  148.                   </div>
  149.                 </div>
  150.                 <button type="button" href="#step2" data-toggle="tab" role="tab"
  151.                         class="btn mr-2 btn-outline-primary btn prev-step">
  152.                   Go Back To Step 2
  153.                 </button>
  154.                 <button type="submit"
  155.                         class="btn mr-2 btn-primary btn">
  156.                   Store
  157.                 </button>

  158.               </div>
  159.             </div>
  160.           </form>
  161.         </div>
  162.       </div>
  163.     </div>
  164.   </div>
  165. </div>

JS:

  1. $(function(){
  2.  // select2
  3.   $('#tag_list').select2({
  4.     placeholder: '',
  5.     dropdownAutoWidth: 'true',
  6.     width: '100%'
  7.   });
  8.   
  9.   // navigation buttons
  10.   
  11.   $('a.nav-link').on('show.bs.tab', function (e) {
  12.     var $target = $(e.target);
  13.     if ($target.parent().hasClass('disabled')) {
  14.       e.preventDefault();
  15.     }
  16.   });

  17.   $(".next-step").click(function (e) {
  18.     var $active = $('.nav-pills li a.active');
  19.     $active.parent().next().removeClass('disabled');
  20.     nextTab($active);
  21.   });

  22.   $(".prev-step").click(function (e) {
  23.     var $active = $('.nav-pills li a.active');
  24.     prevTab($active);
  25.   });

  26.   function nextTab(elem) {
  27.     $(elem).parent().next().find('a.nav-link').click();
  28.   }
  29.   function prevTab(elem) {
  30.     $(elem).parent().prev().find('a.nav-link').click();
  31.   }
  32. });