L
L
lacoste132014-06-30 22:24:58
JavaScript
lacoste13, 2014-06-30 22:24:58

How to select a list item in an accordion to hide it and no error appears in the console?

Help, please, I've already broken my head. The site has a plugin for Joomla - Bootstrap Accordion Menu ( https://www.yireo.com/software/joomla-extensions/b... ). There are several levels in the menu, when the menu is closed, everything is great. When I open any tab, all submenus open. In the plugin itself, as I understand it, it is not implemented so that the submenus are hidden by default. Then plan B is to write a small script.
To begin with, I just wanted to hide the initially unnecessary uls, and later open them on onclick.
I wrote an elementary $('ul').hide();thing, which the browser complained about "TypeError: Cannot read property 'hide' of null"
I climbed in the forums, came to the conclusion that the script works before loading everything else, then I wrote:

window.onload = function(){
$('ul').hide();
}

I stopped giving an error, but it doesn’t hide lists for me either. Tell me what could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman Zhak, 2014-07-01
@romanzhak

Initially, the plugin has a hide state, after loading you put hide again, that is, you do not change anything.
You need to add changes to the plugin so that they are hidden. Well, or a crutch, which is bad: by clicking on an item, I hide them.

I
Ilya Plotnikov, 2014-06-30
@ilyaplot

First, show the html code for the menu.
Try

$(document).ready(function(){
    $('ul').hide();
});

But learn that this code will hide all bulleted lists

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question