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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:35:15+00:00 2026-05-27T13:35:15+00:00

I am working on an application form with multiple Date of Birth fields. I

  • 0

I am working on an application form with multiple Date of Birth fields.

I have created a simple date input with select elements. When the select elements change the values are copied into an additional hidden text field to keep the results.

I have written a function that I want to apply to all the instances of this date input, however, it repeats the same values in the additional date inputs after the first has been filled in.

I think it has something to do with how the variables are set for the function.

How can I get the function to apply to each instance I apply it to without repeating the results?

Js Fiddle example here : http://jsfiddle.net/allyreid/JyE8b/5/

Help appreciated.

  • 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-05-27T13:35:16+00:00Added an answer on May 27, 2026 at 1:35 pm

    Here is the fix:

    $.fn.dateofbirth = function() {
             return this.each(function() {
                  $(this).children('select').change(function(){
                      var cont = $(this).parent();
                      var day = $("select[name='Day']", cont).val();
                      var month = $("select[name='Month']", cont).val();
                      var year = $("select[name='Year']", cont).val();
                      var fullDate = day + " / " +  month  + " / " + year;
                      $(this).parent().find('.result').val(fullDate);
    
                   });
              });
        };
    
        $('td.dob').dateofbirth();
    

    You problem here is that on the “onChange” event, you’re selecting the values using: $("select[name='Day']").val(); and that is only selecting the FIRST day dropdown, that’s why you always get the same value.

    The fix consists on first getting the parent element of the element that originated the change event and then working with the dropdowns that are INSIDE that parent.

    If you have questions about the core, let me know.

    One more thing

    This is what did the trick:

    When selecting elements with jQuery, you can specify the container inside where to look for. That’s what I did there, you have $(SELECTOR STRING, container_element)

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

Sidebar

Related Questions

I'm working on a windows form application and I want to have a rich
I have a winforms application i have been working on that runs multiple tests
I am working on a windows form application. How do i use the find
I m working on windows form application. I need to show amount in words
I am working on a search application that uses a form with 16 filter
I am working on splitting out an existing, working application that I currently have
I have pretty much finished my first working Symbian application, but in my hastened
Now that I have a read-only application working, I am working on the insert
I am working Windows form Application in c#.I like to create crystal report from
I am working on an application suite comprising of multiple Automation servers written using

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.