Пытаюсь переписать jq функцию на чистый js, но получаю ошибку Uncaught DOMException: Document.querySelectorAll: '.main-slider[object HTMLDivElement]' is not a valid selector. Подскажите, как исправить
let mainSlider = [];
let navSlider = [];
let theraphyElements = document.querySelectorAll(".theraphy-swiper");
$(".theraphy-swiper").each(function (index, value) {
var mainSliderSelector = ".main-slider" + index;
var navSliderSelector = ".nav-slider" + index;
mainSliderOptions.navigation.nextEl = ".swiper-arrow-next" + index;
mainSliderOptions.navigation.prevEl = ".swiper-arrow-prev" + index;
navSliderOptions.on.click = function () {
mainSlider[index].autoplay.stop();
};
mainSlider[index] = new Swiper(mainSliderSelector, mainSliderOptions);
navSlider[index] = new Swiper(navSliderSelector, navSliderOptions);
mainSlider[index].controller.control = navSlider[index];
navSlider[index].controller.control = mainSlider[index];
});
let mainSlider = [];
let navSlider = [];
let theraphyElements = document.querySelectorAll(".theraphy-swiper");
theraphyElements.forEach(function (index, value) {
let mainSliderSelector = ".main-slider" + index;
let navSliderSelector = ".nav-slider" + index;
mainSliderOptions.navigation.nextEl = ".swiper-arrow-next" + index;
mainSliderOptions.navigation.prevEl = ".swiper-arrow-prev" + index;
navSliderOptions.onClick = function () {
mainSlider[index].autoplay.stop();
};
mainSlider[index] = new Swiper(mainSliderSelector, mainSliderOptions);
navSlider[index] = new Swiper(navSliderSelector, navSliderOptions);
mainSlider[index].controller.control = navSlider[index];
navSlider[index].controller.control = mainSlider[index];
});