Title: editor breaks embedded javascript
Last modified: August 20, 2016

---

# editor breaks embedded javascript

 *  [bobred](https://wordpress.org/support/users/bobred/)
 * (@bobred)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/editor-breaks-embedded-javascript/)
 * I’ve noticed when pasting javascript into the HTML editor of a post, switching
   to visual mode and back to HTML mode results in the javascript being stripped
   out and replaced with a space?
 * The javascript in question is nothing complex, simply in the form of…
 * `<script type="text/javascript" src="http://www.some.com/page.php?id=1"></script
   >`

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

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 11 months ago](https://wordpress.org/support/topic/editor-breaks-embedded-javascript/#post-2192329)
 * Switching between HTML and Visual editors is a bad idea. It breaks things and
   never works. If you really need to be able to insert JS, or any special code,
   you must use the HTML editor OR make a shortcode.
 *  Thread Starter [bobred](https://wordpress.org/support/users/bobred/)
 * (@bobred)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/editor-breaks-embedded-javascript/#post-2192637)
 * Thanks, i’ve since wrote a plugin that will allow me to add such JS via shortcodes.
   However i’ve also noticed that the editor strips comments out of html, i’m sure
   the editor wasn’t this bad in previous versions of WP?

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

The topic ‘editor breaks embedded javascript’ is closed to new replies.

## Tags

 * [editor](https://wordpress.org/support/topic-tag/editor/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [bobred](https://wordpress.org/support/users/bobred/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/editor-breaks-embedded-javascript/#post-2192637)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
