Title: javascript in posts with quotes
Last modified: August 18, 2016

---

# javascript in posts with quotes

 *  [kallywag](https://wordpress.org/support/users/kallywag/)
 * (@kallywag)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/javascript-in-posts-with-quotes/)
 * I’m trying to call a javascript function from within a post. I have read [Using Javascript](http://codex.wordpress.org/Using_Javascript),
   and the method described there works fine if you’re just calling a function by
   itself, but it breaks if you need to pass parameters to the function like this:`
   afunction('value')` — wordpress adds backslashes before the two single quotes.
   Is there any way to keep wordpress from doing this?
 * Lorelle mentioned using stripslashes() in the article above, and I tried wrapping
   that function around my call to the_content() but the slashes were still appended.

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

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 1 month ago](https://wordpress.org/support/topic/javascript-in-posts-with-quotes/#post-562264)
 * > _wordpress adds backslashes before the two single quotes_
 * I’m not seeing that on mine, but nevertheless…
 * Have you tried double quotes instead?
 *  Thread Starter [kallywag](https://wordpress.org/support/users/kallywag/)
 * (@kallywag)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/javascript-in-posts-with-quotes/#post-562483)
 * I can’t use double quotes if my javascript call is in an attribute because it
   would mistakenly signal the end of the attribute value:
 * `<a href="/blah" onclick="dothis("param","param2"); return false;">Link</a>`
 * NOTE: For reference, this particular WP install was done just a few days ago 
   with the latest release (2.1.3).
 *  [tibberous](https://wordpress.org/support/users/tibberous/)
 * (@tibberous)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/javascript-in-posts-with-quotes/#post-562560)
 * I’d like to know too – bump.

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

The topic ‘javascript in posts with quotes’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [tibberous](https://wordpress.org/support/users/tibberous/)
 * Last activity: [18 years, 4 months ago](https://wordpress.org/support/topic/javascript-in-posts-with-quotes/#post-562560)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
