× Got a CSS, HTML or webdesign question? Ask it here!

Javascript issue with accordion

1 year 4 months ago - 1 year 4 months ago #17419 by JimUMFan
Replied by JimUMFan on topic Javascript issue with accordion
I FIGURED IT OUT

It was still bugging me that I didn't know how it was broken so I looked into it a little bit more.

It previously wasn't working because you had the <button> inside of a <p> element. That broke it because the javascript is using "this.nextElementSibling" which returns the next element with the same parent, but because the <button> element was the only child of the <p> element it had no siblings so that function returned nothing. The panel variable contained nothing and caused the remaining javascript to break.
The following user(s) said Thank You: adamp, sgarofalo

Please Log in or Create an account to join the conversation.

Time to create page: 0.095 seconds
Powered by Kunena Forum