Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8274457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:44:14+00:00 2026-06-08T07:44:14+00:00

Would appreciate any help to a newbie here. I have a simple if/else if

  • 0

Would appreciate any help to a newbie here. I have a simple if/else if statement that for some reason only gets to the second condition, even if the third is met. I’ve tried adding else to the end, tried pretty much everything but still nothing. I know it’s not working, because I added the alert triggers and no matter what it never gets to the third condition. What am I missing here? I’ve looked around a lot so I’m sorry if I’m beating a dead horse here but I couldn’t find a solution. I should note that I’m trying to get the conditions on the change of a selection drop-down box. Thanks!!!

My code:

$('#table_two select:eq(6)').change(function(e){

var allDiv = $('#table_two,#table_three,#table_four');
var parBoxOne = $('#par_one').val();

var totalOne = 1 - parBoxOne;
var totalTwo = 2 - parBoxOne;


if ($(this).val() == "made_shot"){
$(allDiv).hide();
$('#score_one').val(totalOne);
$('#score_total').val($('.score_input').val());
alert('ACE!!');
}

else if ($(this).val() == 'green', 'trees', 'fairway', 'rough', 'sand' ){
$('#score_one').val(totalOne);
$('#score_total').val($('.score_input').val());
$('#table_two').hide();
$('#butt_two').html('Show stroke');
alert('triggered two');
}

else if ($(this).val() == 'other', 'penalty_water', 'penalty_ob', 'penalty_sand' ){
$('#score_one').val(totalTwo);
$('#score_total').val($('.score_input').val());
$('#table_two').hide();
alert('triggered three');
}

});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:44:15+00:00Added an answer on June 8, 2026 at 7:44 am

    Just another apporoach:

    switch($(this).val()){
        case 'made_shot':
            $(allDiv).hide();
            $('#score_one').val(totalOne);
            $('#score_total').val($('.score_input').val());
            alert('ACE!!');
            break;
    
        case 'green':
        case 'trees':
        case 'fairway':
        case 'rough':
        case 'sand':
            $('#score_one').val(totalOne);
            $('#score_total').val($('.score_input').val());
            $('#table_two').hide();
            $('#butt_two').html('Show stroke');
            alert('triggered two');
            break;
    
        case 'other':
        case 'penalty_water':
        case 'penalty_ob':
        case 'penalty_sand':
            $('#score_one').val(totalTwo);
            $('#score_total').val($('.score_input').val());
            $('#table_two').hide();
            alert('triggered three');
            break;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to Java and would appreciate any help on this! I have
I am stuck here, any help would be appreciated. I have a listbox of
Would really appreciate some help with this. I have an app which consists of
I am a newbie to Serial Port Analysis and I would appreciate some help
I'm a javascript newbie so please, any help would be appreciate. I've been trying
I am a newbie and would appreciate some help on how to resolve this
A newbie in regex here, I will appreciate any help. cstring = [0,90,(+45,45)3,0/]S regex
I would appreciate any help on this issue. Lets say I want to load
I would really appreciate any help with the following problem: I need to be
Would very much appreciate any help or hint on were to go next. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.