Help needed with small JS script working locally, but not when added to WordPress website. via /r/learnprogramming


Help needed with small JS script working locally, but not when added to WordPress website.

Hello there.

I currently have a small problem with a script, as it works perfectly locally, yet once uploaded to WordPress, the functionality isn't there.

I have a button which when clicked, displayed content below it.

Button Title

Example Text Or email us directly here.

Call us on 00000000.

Take me back to the top.

</div>

The script is as follows: var acc = document.getElementsByClassName(“accordion”); var i;

for (i = 0; i

 /* Toggle between hiding and showing the active panel */ var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } } 

}

Can anyone please enlighten me as to why this code only runs locally and not when uploaded to a WordPress website? Many thanks in advance.

Submitted July 17, 2017 at 06:24AM by Tuff_FishUK
via reddit http://ift.tt/2t71gVD

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s