We help IT Professionals succeed at work.

Javascript and form states

Medium Priority
706 Views
Last Modified: 2013-11-19
I have a javascript I inherited and it seems that the if conditionals are not working correctly.

After reviewing it and trying some adjustments in how the elements are selected, I'm still baffled with the if conditional if ('foo' == "BAR") and why they are not interpreting the way the scripter expected.

Experts please have a look and make some n00b suggestions for me? Thanks!
Comment
Watch Question

Kelly BlackSenior Linux / DBA / DEVOPS
CERTIFIED EXPERT

Author

Commented:
shopping cart script needs mod
legacy-shopping-cart-mods.txt
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2019

Commented:
Not sure what the qustion is here? Can you elaborate?
Senior Linux / DBA / DEVOPS
CERTIFIED EXPERT
Commented:
First thing I'm curious about is that

function changeCountry(country) {
    if (country == 'US') {

produces a syntax error. It seems there are many ways to do the conditional formatting, so perhaps comparing a variable imported by the function must have double quotes?
Kelly BlackSenior Linux / DBA / DEVOPS
CERTIFIED EXPERT

Author

Commented:
The script is broken in several places, not practical for experts to answer.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.