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:
- if (container.nodeName === 'UL') { // line 155
Do you know where can be the issue?
HTML:
JS:
- $(function(){
- // select2
- $('#tag_list').select2({
- placeholder: '',
- dropdownAutoWidth: 'true',
- width: '100%'
- });
-
- // navigation buttons
-
- $('a.nav-link').on('show.bs.tab', function (e) {
- var $target = $(e.target);
- if ($target.parent().hasClass('disabled')) {
- e.preventDefault();
- }
- });
- $(".next-step").click(function (e) {
- var $active = $('.nav-pills li a.active');
- $active.parent().next().removeClass('disabled');
- nextTab($active);
- });
- $(".prev-step").click(function (e) {
- var $active = $('.nav-pills li a.active');
- prevTab($active);
- });
- function nextTab(elem) {
- $(elem).parent().next().find('a.nav-link').click();
- }
- function prevTab(elem) {
- $(elem).parent().prev().find('a.nav-link').click();
- }
- });