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

  • Home
  • SEARCH
  • 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 8866237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:44:35+00:00 2026-06-14T16:44:35+00:00

I am trying to use a slightly modified version of this code to show/hide

  • 0

I am trying to use a slightly modified version of this code to show/hide the field Return Time on this page based on Type of Trip:

One Way: Return Time is hidden

Round Trip: Return Time is shown

Here is the Select Box html. Code is autogenerated by cforms on wordpress.

<select name="TripType" id="TripType" class="cformselect" >
                <option value="One Way">One Way</option>
                <option value="Round Trip">Round Trip</option>
            </select>

And here is the form element I’m trying to hide:

<li id="li--8" class=""><label id="label--8" for="DepartLeg2-Time"><span>Return Time</span></label><select name="DepartLeg2-Time" id="DepartLeg2-Time" class="cformselect" >
                    <option value="12:00am">12:00am</option>
                    <option value="12:30am">12:30am</option>
                    <option value="1:00am">1:00am</option>
                    <option value="1:30am">1:30am</option>
                    <option value="2:00am">2:00am</option>
                    <option value="2:30am">2:30am</option>
                    <option value="3:00am">3:00am</option>
                    <option value="3:30am">3:30am</option>
                    <option value="4:00am">4:00am</option>
                    <option value="4:30am">4:30am</option>
                    <option value="5:00am">5:00am</option>
                    <option value="5:30am">5:30am</option>
                    <option value="6:00am">6:00am</option>
                    <option value="6:30am">6:30am</option>
                    <option value="7:00am">7:00am</option>
                    <option value="7:30am">7:30am</option>
                    <option value="8:00am">8:00am</option>
                    <option value="8:30am">8:30am</option>
                    <option value="9:00am">9:00am</option>
                    <option value="9:30am">9:30am</option>
                    <option value="10:00am">10:00am</option>
                    <option value="10:30am">10:30am</option>
                    <option value="11:00am">11:00am</option>
                    <option value="11:30am">11:30am</option>
                    <option value="12:00pm">12:00pm</option>
                    <option value="12:30pm">12:30pm</option>
                    <option value="1:00pm">1:00pm</option>
                    <option value="1:30pm">1:30pm</option>
                    <option value="2:00pm">2:00pm</option>
                    <option value="2:30pm">2:30pm</option>
                    <option value="3:00pm">3:00pm</option>
                    <option value="3:30pm">3:30pm</option>
                    <option value="4:00pm">4:00pm</option>
                    <option value="4:30pm">4:30pm</option>
                    <option value="5:00pm">5:00pm</option>
                    <option value="5:30pm">5:30pm</option>
                    <option value="6:00pm">6:00pm</option>
                    <option value="6:30pm">6:30pm</option>
                    <option value="7:00pm">7:00pm</option>
                    <option value="7:30pm">7:30pm</option>
                    <option value="8:00pm">8:00pm</option>
                    <option value="8:30pm">8:30pm</option>
                    <option value="9:00pm">9:00pm</option>
                    <option value="9:30pm">9:30pm</option>
                    <option value="10:00pm">10:00pm</option>
                    <option value="10:30pm">10:30pm</option>
                    <option value="11:00pm">11:00pm</option>
                    <option value="11:30pm">11:30pm</option>
                </select></li>

Here is the javascript I’m using:

$("#TripType").change(function() {
  $("#li--8")[$(this).val() == "Round Trip" ? 'show' : 'hide']("fast");
}).change();

I have the code working here on JSFiddle: http://jsfiddle.net/MS4Ck/. However, it is not working on the site. My console is not giving me any errors except for a reference error coming from some logging code I put in there to make sure the javascript is being called (it is). Any ideas? Thank you so much!

  • 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-14T16:44:36+00:00Added an answer on June 14, 2026 at 4:44 pm

    Just a guess, but make sure this function is wrapped in a docReady function eg:

    $(document).ready(function() {
        $("#TripType").change(function() {
            $("#li--8")[$(this).val() == "Round Trip" ? 'show' : 'hide']("fast");
        }).change();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use jQuery to make a slightly more sophisticated page refresh. With
I am trying to solve this CodingBat problem: (This is a slightly harder version
i'm trying use facebook API to upload photo in my fan page. I downloaded
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am need paint my image. I'm trying use JQuery in here this link:
I'm trying to use T4 templates to make generating migrations for our system slightly
I used a slightly modified version of Ryan Scherf's jQuery swipe plugin on a
I am trying to use Qunit to test some code, but I have some
Referring to a slightly modified version of a jqGrid local editing demo by user
I'm trying to run tclhttpd in a slave interpreter but slightly modified so as

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.