Sunday, 18 August 2013

Why operator && does not work in WordPress Javascript/jQuery code?

Why operator && does not work in WordPress Javascript/jQuery code?

I'm creating web site in WordPress, but suddenly && operator stopped
working in Javascript/jQuery codes. For example the code
<p>Click the button to trigger a function.</p>
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x=9, y=3;
if (x < 10 && y > 1){
document.getElementById("demo").innerHTML="Hello World";
}
}
</script>
perfectly is working without WordPress, but inside WordPress there are no
result after clicking the button. The code is working inside WordPress
without && operator (e.g. if (x < 10)) or using the || operator instead of
&&.

No comments:

Post a Comment