Я не могу понять, что я делаю неправильно. Вот ссылка, чтобы увидеть пример. http://atozcognac.com/hotel/form/# Мои предыдущие и следующие кнопки работают, но я не могу понять, как изменить вкладки, если пользователь нажимает prev или next. Спасибо за ваше время. $ (документ) .ready (функция() {Навигация по модальной форме
//When someone clicks on the navigation links
$('.nav li').click(function(e){
$('.nav li').attr('id', ''); //make all navtabs inactive
$(this).attr('id', 'activetab'); //make the one we clicked active
//hide all of the fieldsets
$('fieldset').attr('class', 'myHidden');
whichitem=$(this).attr('title'); //get the title of the nav we clicked
//make the class of what we cleared not hidden
$("fieldset[title='"+whichitem+"']").attr('class', '');
});
//When someone clicks on the previous button
$('.prev').click(function(e){
var listItem = document.getElementById('activetab'); //find out which navtab is active
whichOne=$('li').index(listItem); //get the index of the navtab
$('.nav li').attr('id', ''); //make all the navtabs inactive
$(".nav li:eq("+(whichOne-1)+")").attr('id', 'activetab'); //make previous tab active
$('fieldset').attr('class', 'myHidden'); //hide all the fieldsets
$("fieldset:eq("+(whichOne-1)+")").attr('class', ''); //show the previous fieldset
});
//When someone clicks on the next button
$('.next').click(function(e){
var listItem = document.getElementById('activetab'); //find out which navtab is active
whichOne=$('li').index(listItem); //get the index of the navtab
$('.nav li').attr('id', ''); //make all the navtabs inactive
$(".nav li:eq("+(whichOne+1)+")").attr('id', 'activetab'); //make next tab active
$('fieldset').attr('class', 'myHidden'); //hide all the fieldsets
$("fieldset:eq("+(whichOne+1)+")").attr('class', ''); //show the next fieldset
});
});
Спасибо за быстрый ответ на какой-то причине до сих пор не работает для меня. – user2432772
Я обновил код. Может быть, теперь он будет работать !? – friedi
Спасибо за помощь, но до сих пор не работают , – user2432772