Title: WordPress is altering my Javascript
Last modified: August 21, 2016

---

# WordPress is altering my Javascript

 *  Resolved [VictoryCheer](https://wordpress.org/support/users/victorycheer/)
 * (@victorycheer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/)
 * 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', '','
   http://www.chassecheer.com/images/accessories/AC336/AC336-Black.jpg',1);void(
   0);">`
 * on web: `<a href="javascript:MM_swapImage('itemImg', '', 'http://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](http://www.chassecheer.com/cheerleading-accessories/cheer-bows-ribbons/2-color-jumbo-star-cheerleading-hair-bow/)
 * Can anyone tell me why this is happening and how to fix it?
 * Thanks, Sandra

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661344)
 * Have you reviewed [Using_Javascript](http://codex.wordpress.org/Using_Javascript)?
 *  Thread Starter [VictoryCheer](https://wordpress.org/support/users/victorycheer/)
 * (@victorycheer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661359)
 * Hi esmi,
 * Thanks for your quick response. My roll-over script is included in my header 
   now like so: `<script type="text/javascript" src="http://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
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661367)
 * 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](http://getfirebug.com/)?
 *  Thread Starter [VictoryCheer](https://wordpress.org/support/users/victorycheer/)
 * (@victorycheer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661376)
 * 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
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661387)
 * WordPress will not “change your code” from an external .js file that has been
   correctly enqueued.
 *  Thread Starter [VictoryCheer](https://wordpress.org/support/users/victorycheer/)
 * (@victorycheer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661408)
 * 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', '', 'http://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', '', 'http://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](https://wordpress.org/support/users/victorycheer/)
 * (@victorycheer)
 * [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661438)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 2 participants
 * Last reply from: [VictoryCheer](https://wordpress.org/support/users/victorycheer/)
 * Last activity: [12 years, 12 months ago](https://wordpress.org/support/topic/wordpress-is-altering-my-javascript/#post-3661438)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
