Response title
This is preview!
active
class to the divs that have d-none
class already? as you can see from my code I am adding the active
class by index to all .tab-pane
divs but I want to skip adding the active to the div with d-none
class and add it to next available element$("button").on("click", function(){
var index = $("#content-tabs .tab-pane.active").index();
index = index+1;
$(".tab-pane").removeClass('active');
$(".tab-pane").eq(index).addClass('active');
});
$("button").on("click", function(){
var index = $("#content-tabs .tab-pane.active").index();
index = index+1;
$(".tab-pane").removeClass('active');
var elem = $(".tab-pane");
if (!elem.hasClass("d-none")) {
elem.eq(index).addClass('active');
}
});
© 2013 jQuery Foundation
Sponsored by and others.