Collapsible button inside a ul list does work in jsfiddle but not in WP
-
I implemented a collapsible button, it works well in WP, but if I insert it in a
ul
list it doesn’t work, that is the button does not open.Then I tried to run the code in jsfiddle and there it does work.
The only difference between the WP code and the jsfiddle code is in the javascript
- on WP the
var content
is defined bythis.parentElement.nextElementSibling;
- on jsfiddle the
var content
is defined bythis.nextElementSibling;
This is due to the fact that
- by removing
parentElement
on WP the button will break - by adding
parentElement
on jsfiddle the button will break
Just for information, the javascript on WP is loaded in the footer.
Is it possibile to fix the problem? Here is the jsfiddle demo.
____________________________________________________________________
Below you can see jsfiddle vs WP
- on WP the
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘Collapsible button inside a ul list does work in jsfiddle but not in WP’ is closed to new replies.