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 8973157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:23:01+00:00 2026-06-15T18:23:01+00:00

I’ve been given two arrays, each of which has several objects within them. I’m

  • 0

I’ve been given two arrays, each of which has several objects within them. I’m trying to make it so that when a certain dropdown selection is made, it pushes that “flight information” into a “flight summary” div, but I’m having a hard time figuring out how to do it.

var possibleDepartureFlights=[{year:2012,month:11,day:13,hour:17,minute:37,price:137.38} and so on]; 

var possibleReturnFlights=[{year:2012,month:11,day:18,hour:21,minute:45,price:189.46} and so on];

Each var has 10 objects within the array, each of which has all those properties.

And as a bonus question, I’ve figured out how to hide a “submit” button when the return flight selected is earlier than the departure, but I can’t figure out how to make the submit button come back when a different selection is made!

function displayDivs() {
var departureValue = $('#departureFlightsControl').val();
var returnValue = $('#returnFlightsControl').val();
if (departureValue != "default") {
    $('.CumulativeSummary').addClass('totalAvailable');
    $('.DepartureSummary').addClass('flightChosen');
}
if (returnValue != "default") {
    $('.CumulativeSummary').addClass('totalAvailable');
    $('.ReturnSummary').addClass('flightChosen');
}
if ($('#returnFlightsControl').val() < $('#departureFlightsControl').val()) {
    $('.SubmitArea').hide();
}

Sorry if this question is vague! I’m new to jQuery and JavaScript, so I’m not really sure what I’m doing (and I’m not even really sure what to Google for to find the answer to my problem(s)). Please use small words, as if you’re speaking to a child. Thanks!

  • 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-15T18:23:02+00:00Added an answer on June 15, 2026 at 6:23 pm

    Your question is really too broad, anyways… Suppose you have following

    var possibleDepartureFlights=[
        {year:2012,month:10,day:13,hour:10,minute:37,price:137.38}, 
        {year:2012,month:11,day:15,hour:17,minute:47,price:150.50} 
    ];
    

    The possibleDepartureFlights is an array of two objects and the first element of the array is the first object and it’s {year:2012,month:10,day:13,hour:10,minute:37,price:137.38} and it’s index is 0 and the second element in your possibleDepartureFlights array is the second object and it’s {year:2012,month:11,day:15,hour:17,minute:47,price:150.50} and it’s index is 1. Now, if you want to access the month property of the first item of the array then you can write like

    alert(possibleDepartureFlights[0].month); // this will alert 10
    

    For the month of the second item/object in the array you can write

        alert(possibleDepartureFlights[1].month); // this will alert 11
    

    To loop through the array and print out the each property of every objects, you can try this

    for(i=0;i<possibleDepartureFlights.length;i++)
    {
        console.log(possibleDepartureFlights[i].year);
        console.log(possibleDepartureFlights[i].month);
        console.log(possibleDepartureFlights[i].hour);
        console.log(possibleDepartureFlights[i].minute);
        console.log(possibleDepartureFlights[i].price);
    }
    

    An Example Here.

    Remember, this is only a short example and there are more about arrays and objects in JavaScript. Also remember that you can loop an object with for in like for loop. Also this one could be helpful too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I have an array which has BIG numbers and small numbers in it. I
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't

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.