javascript - Whats the difference between these 2 script If Statements and why 1 of them Wont work -
code 1 (don't care other value expet one, value don't want continue)
if (!optval == "select report")code 2 (checking options of dropdown way)
if (optval == "lpr-standard lease report" || optval == "open acreage summary report" || optval == "capital ownership report") {
following this, theres other code runs functionality.
i check value of optval before going if statement chromes built in developer tools. value comes in definatly not select report.

you can see here there not equal , next line not 234, end of if statement below.
code1 seems doesn't matter
optval, considered(!optval == "select report")code2 runs perfect.
i wonder if in javascript (!variable) not permitted have (!variable= value)??
it's order of operations issue, add paren's:
if (!(optval == "select report")) or use
if(optval != "select report")
Comments
Post a Comment