• I found out why my Javascript, which works everywhere else, stops working when placed in WordPress. It won’t process &&(AND) and ||(OR). Can this be right?

    When I break up the lines and remove the operators, the script runs in WP. But this makes for kinda clumsy and long scripts. I did a quick look around to see if anyone is talking about this, but I haven’t found anything yet.

    Do I really have to write JS differently for WP? Is there a workaround?

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator cubecolour

    (@numeeja)

    javascript runs in the browser, not on the server

    Thread Starter lkingman

    (@lkingman)

    ? I’ve been to that link, I found nothing to explain this.

    ? I am simply typing JS into the html window in WP. It runs in three different browsers independently of WP, but not via WP.

    Can anyone explain why? Let me try it this way:

    Can you enter JS in the html window with &&s and ||s and have it run correctly? If so I’d really like to know what you’re doing differently. This is the same standard JS I’ve been writing for ten years.

    Thanks for heads up on where it runs, though.

    Re-read the page that esmi linked.

    Specifically, focus on the Javascript in Posts section. Take special note of the need to create a separate Javascript file where you have the script that you want to run.

    Then, in your page or post (through the WP HTML editor), you need to combine the call to both the file and the Javascript itself.

    If you just want Javascript that will run on your site in general and don’t need it limited to a specific page or post, you can just insert it normally into the site code by editing your active theme file(s).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Really? WP won't process Javascript AND or OR?’ is closed to new replies.