Do some Javascripts not work in WP, at all?
-
I am about to pull my hair out with this one and I have looked all over the internet, the ‘Using Javascript’ page here, in WordPress, and all over the support forums but none of the suggestions help.
I have a very simple script that creates a collapsible area in my page. Now, it works perfectly outside of WP here:
https://www.noggaddicts.com/Untitled-6.php
but when I actually insert that into my page such as here:
https://www.noggaddicts.com/?p=190Now, I’ve tried to make it work by typing out:
<script type="text/javascript" src="/js/toggle.js">
<!--
toggleBB(patch201, bbArrow01);
//--></script>instead of just:
<script type="text/javascript">
<!--
toggleBB(patch201, bbArrow01);
//--></script>I’ve tried changing the javascript URL from absolute to relative, to full URL, to actually typing out the script in the header and none of that works. It’s like the script is not being run, at all.
Here’s the script, which is the contents of the toggle.js:
function toggleBB(srcElement, srcArrow) {
if (srcElement.style.display == "none") {
srcElement.style.display = "";
srcArrow.src = "/images/expand.gif";
} else {
srcElement.style.display = "none"
srcArrow.src = "/images/collapse.gif";
}
}Any help on this would be greatly appreciated.
Edit:
To clarify and expand on what troubleshooting I’ve done:
I have Rich Editor turned off.
I use Script Enabler plugin.
I use Text Control and I turned off formatting and texturization.The code looks perfect when I look at the source, but it’s just not being run.
I also tried putting in the code outside of a post, in my sidebar to see if it was something to do with it being in the post and it does the exact same thing, which is nothing.
- The topic ‘Do some Javascripts not work in WP, at all?’ is closed to new replies.