• Resolved VictoryCheer

    (@victorycheer)


    This all very strange. My Javascript roll-overs were working perfectly and now they not. The odd thing is that they’re correct in the admin-side when I look at a page in the editor, but they’re being outputted to the web incorrectly.

    Here’s a sample:
    in editor: <a href="javascript:MM_swapImage('itemImg', '', 'https://www.chassecheer.com/images/accessories/AC336/AC336-Black.jpg',1);void(0);">

    on web: <a href="javascript:MM_swapImage('itemImg', '', 'https://www.chassecheer.com/images/accessories/AC336/AC336-Black.jpg" ,1);void(0);">

    Note the closing single quote on the image url. On the web, it’s been changed to a double quote.

    Here’s the sample web page: Sample Page

    Can anyone tell me why this is happening and how to fix it?

    Thanks, Sandra

Viewing 7 replies - 1 through 7 (of 7 total)
  • Have you reviewed Using_Javascript?

    Thread Starter VictoryCheer

    (@victorycheer)

    Hi esmi,

    Thanks for your quick response. My roll-over script is included in my header now like so: <script type="text/javascript" src="https://www.chassecheer.com/js/common.js"></script>

    It still doesn’t fix the problem. Everything else looks OK according to the Using Javascript page.

    — Sandra

    In that case, I can only guess that there’s an issue in your JavaScript. Have you tried debugging it using Firefox with the Firebug add-on?

    Thread Starter VictoryCheer

    (@victorycheer)

    That won’t help. Firebug can only tell where the problem is, it can’t tell me why wordpress is changing my code. As stated in my first post, everything is correct in the editor, but wordpress is outputting to the webpage incorrectly. I can go back the page in the editor and it’s still correct, just wrong on the site.

    I have ruled out the theme. In Live Preview, Twenty-Twelve is doing the same thing.

    — Sandra

    WordPress will not “change your code” from an external .js file that has been correctly enqueued.

    Thread Starter VictoryCheer

    (@victorycheer)

    You’re not understanding what I’m saying. WordPress is not altering the common.js.

    If you go to the Sample page link above and look at the page. You’ll see a product image with a bunch of color swatches. You’re suppose to be able to click on the swatches to change the color of the product. To do this, each swatch image has link to the javascript code to trigger this effect on click. That link should look like this: <a href="javascript:MM_swapImage('itemImg', '', 'https://www.chassecheer.com/images/accessories/AC336/AC336-Black.jpg',1);void(0);"> but unfortunetely wordpress is changing it to this: <a href="javascript:MM_swapImage('itemImg', '', 'https://www.chassecheer.com/images/accessories/AC336/AC336-Black.jpg" ,1);void(0);">

    It look the same, but its not. There’s a single quote (‘) after the image url in first example and a double quote (“) on the second example. This is what’s causing my Javascript to break. In the page editor of wordpress it’s fine, but on the actual web page it’s wrong. Again the problem started some time this weekend. I moved my site to a new directory on Friday, but this isn’t a problem about broken links. I’ve been working on the site for 4 months with no problems.

    — Sandra

    Thread Starter VictoryCheer

    (@victorycheer)

    I’ve partially figured it out. I remembered that I also added some new plugins on Friday. So I start turning them off one at a time. It turns out that “Google Analytics for WordPress” is source of the problem. Still doesn’t make any sense. I’ll be posting the problem with the plugin developer.

    Thanks, Sandra

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WordPress is altering my Javascript’ is closed to new replies.