When using JavaScript in a WP post, be careful of white space.

Just learned this. If you are creating a post and want to insert some Javascript into the code (HTML) tab view of the post, be careful of BLANK lines. So if your JavaScript and HTML code worked before you put into WP, watch any source paths and watch those blank lines.  It could be THAT simple. It was for me.

Example one is what I pasted in:


Example two is how is was changed by WP – depends on your WYWISYG editor – some do this, some do not:


Example three is the same code without blank lines which fixed the script and now it works perfectly: