Javascript not working in posts
-
Hi,
I’ve googled this problem and also checked out the codex page for javascript and that wasn’t much help either (I’m a WordPress beginner). Sometimes I’m not sure if the advice if for me or for plugin/theme developers.What I am looking for is the ability to have an external javascript file (scriptname.js) on my server which contains all the javascript functions I’ll be using in my post. Then I want to be able to create a post which uses these functions.
After lots of trial and error I was able to get some of the javascript working, but not the rest. It works 100% when I test it locally. I’m using the “Custom fields shortcode” plugin and then using a customfield [cf]js[/cf] to access the javascript code. This may not be a good way to do it, but it’s the only way I’ve been able to get working so far. If there’s a better way, please tell me 🙂
If you look at the page http://www.arbzilla.com/category/free-arb-bets/ you will see that the border rollover effects work fine, but in step 4, the “recalculate” button does nothing, even though it has events attached to it (onMouseOver=”highlight_button()” onMouseOut=”unhighlight_button()” onclick=”click_recalculate_button()”).
Is there an easy step-by-step way to allow me to create posts that make use of my external javascript file?
Thanks 🙂
The topic ‘Javascript not working in posts’ is closed to new replies.