G
G
gladislav992020-11-04 15:57:38
opencart
gladislav99, 2020-11-04 15:57:38

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

3 answer(s)
G
gladislav99, 2020-11-05
@gladislav99

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');
}
}

N
Nikita Mikhailov, 2020-11-04
@Psixodelik

The Location interface . With it, you can recognize a specific page.

M
mirexdoors, 2020-11-04
@mirexdoors

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 question

Ask a Question

731 491 924 answers to any question