• I’m trying to call a javascript function from within a post. I have read 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)

    (@otto42)

    www.ads-software.com Admin

    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

    (@kallywag)

    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).

    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.