Answer the question
In order to leave comments, you need to log in
How to hide div on only one page using js?
There is a website on OpenCart and in each category icons of subcategories from the database are displayed. How to hide subcategory icon data for only one category? Is it possible somehow with the help of Js to find out which page is now and if the one that needs to be disabled is a certain div block?
Answer the question
In order to leave comments, you need to log in
If anyone is interested, I implemented it like this
function HideCat() {
// Проверяем условие - Если /url/ (Адрес страницы) совпадает с текущим, то выполняем следующее действие
if(/url/.test(window.location.href)){
// Находим нужный нам div и добавляем ему класс hidden (в css естественно добавляем этот класс с display:none;)
$('div').addClass('hidden');
}
}
The Location interface . With it, you can recognize a specific page.
Are you sure it needs to be done on the client side? The task sounds like it would be more logical to do it on the back
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question