Support » Fixing WordPress » Javascript double ampersand (&&) problem

  • Hi,

    I have just added some javascript to the wordpress sites I have set up however the && gets converted into & # 0 3 8 ; s and therefore doesn’t work.

    Using the html editor only (disabled Visual incase it was causing the problem), a page looks like …

    <script type=”text/javascript”>// <![CDATA[
    if ((a) && (b))
    // ]]></script>

    I know the rest works, because if I replace if ((a) && (b)) with if (a) { if (b) etc then the page works as I expect. How can I stop the && getting replaced with & # 0 3 8 ; & # 0 3 8 ;? I know I could recode every page, but it seems a little daft that wordpress is changing my code without my wish. What else is it doing that I haven’t noticed!


Viewing 3 replies - 1 through 3 (of 3 total)
  • Forgot to say I’ve tried with and without CDATA, with and without // in all perms and combs I can think of, but not difference, && still gets changed.

    Any cure for this double ampersand issue, placing javascript in WP? Using Genesis I can place the code in the header properly, but then things don’t work as they should…

    Moderator Andrew Nevins


    Forum moderator

    We don’t support Genesis so you’d be best asking your theme’s vendors.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript double ampersand (&&) problem’ is closed to new replies.