I am new to javascript and have a small snippet of code that I want to convert from jQuery to Javascript. Any pointers or can someone help?
A little background on the code – this is a function to toggle between tabs that populates different content when toggled. Here is the code:
$("document").ready(function () {
$(".tab-slider--body").hide();
$(".tab-slider--body:first").show();
});
var tabSlider = document.querySelectorAll(".tab-slider--nav li");
$(".tab-slider--nav li").click(function () {
$(".tab-slider--body").hide();
var activeTab = $(this).attr("rel");
$("#" + activeTab).fadeIn();
if ($(this).attr("rel") == "tab2") {
$(".tab-slider--tabs").addClass("slide");
} else {
$(".tab-slider--tabs").removeClass("slide");
}
$(".tab-slider--nav li").removeClass("active");
$(this).addClass("active");
});