0

I have an overly simple javascript function and I can't figure out why the if statement isn't triggering in it:

var theChange;
function showChangeBox(theChange) {
    if (theChange == 'fName') {
        document.getElementById('userPanelChangeBox').innerHTML = 'Some HTML';
        }
    document.getElementById('userPanelChangeBox').style.display = "block";
    return;
    }

It's called by an onClick:

<a href="#" onclick="showChangeBox('fname');">Click to Change</a>

Simple, right? I've done a bunch of these before, I can't figure out why this isn't working, I'm sure it's something ridiculous that I missed but after staring at it for 20 minutes, my tunnel vision might be preventing me from seeing the error.

It's triggering the change to the display, but I know it isn't going to the if because if I put an alert in it, I get no alert. Grrr. Thanks for the help.

1 Answer 1

2

It's a matter of case, "fName" != "fname".

Sign up to request clarification or add additional context in comments.

1 Comment

*&#(@$ - I knew it was something stupid like that, thank you for saving the rest of the hair on my head. Odd how we don't see things we know to look for after we've gone on tilt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.