WordPress.org

Ready to get started?Download WordPress

Forums

Javascript double ampersand (&&) problem (4 posts)

  1. rbassett
    Member
    Posted 2 years ago #

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

    SOME HTML
    <script type="text/javascript">// <![CDATA[
    //<![CDATA[
    SOME CODE
    if ((a) && (b))
    {
    SOME CODE;
    }
    SOME CODE
    //]]>
    // ]]></script>
    SOME HTML

    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!

    Thanks

  2. rbassett
    Member
    Posted 2 years ago #

    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.

  3. macmeister
    Member
    Posted 1 year ago #

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

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.