javascript - Multiple combined ifs inside an if -


got multiple combined ifs inside if. if there 1 if combined conditions, works fine. add another, stops working. js code looks this

var ttl = //dynamic text var curcookie = //dynamicly calculated number if ( ttl.indexof('something') !== -1 ) //this "if" works in case       {          var result1 = "dynamic number" //works fine          var result2 = "dynamic number" //works fine          var result3 = "dynamic number" //works fine          if ( ( curcookie > result1) && (curcookie < result2) ) { $(".div1").show(); }         //works without 1 bellow         if ( ( curcookie > result2) && (curcookie < result3) ) { $(".div2").show(); }         // works without 1 above         if (curcookie > result3) { $(".div3").show(); }            } }  

as i've mentioned, works fine until add

if ( ( curcookie > result2) && (curcookie < result3) ) { $(".div2").show();} 

so, i'm guessing mistake somewhere here, have no idea is.

fiddles

working https://jsfiddle.net/qxhm2vx9/

not working https://jsfiddle.net/rbhz7lfj/

you missing opening bracket here

if ( curcookie > result2) && (curcookie < result3) ) { $(".div2").show(); } 

should be

if (( curcookie > result2) && (curcookie < result3) ) { $(".div2").show(); } 

well thats why jsfiddle isnt working


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -