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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:46:18+00:00 2026-06-13T22:46:18+00:00

I am trying to auto populate a date range of visible elements. The code

  • 0

I am trying to auto populate a date range of visible elements. The code I have works fine as long as there is only one empty end date that is filled, but I am having difficulty understanding why the clone() method is running twice.

Fiddle is here.

Basically they are jobs, and roles. A job can have many roles, and I guess roles within a parent job could have overlapping start and end times, but is not necessary for this aspect. The Jobs can, and do, overlap start and end times. The code works by looking for the start and end times described within the HTML of the ROLES, and if there is no end time designated, then to populate the roles end time as “CURRENT”. Then, to populate the JOB times, it gathers all of the start times in the array start (var start = []) and all the end times in the array end (var end = []). It then sorts start and end, and takes the first start index(date) for the beginning of the JOB, and the last index(date) of end for the JOB’s end date. Somehow the issue is in the line $(this).find('>h1').after($('.workexperience time.end[datetime=' + end[end.length-1] + ']').clone());
, as the arrays seem to be correct.

Can you help point me in the right direction of the error in my code?

per nnnnnn:
the query $('.workexperience time.end[datetime=' + end[end.length-1] + ']') PRIOR TO THE CLONE is:

[
​Current ​​
,
​Current ​​
]

[
​Sep 2012​​
]

[
​Current ​​
,
​Current ​​
,
​Current ​​
,
​Current ​​
]

[
​Mar 2006​​
]

[
​Jun 2002​​
]

The query end[end.length-1] of the variable end results in :

2012-11

2012-09

2012-11

2006-03

2002-06

  • 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-13T22:46:19+00:00Added an answer on June 13, 2026 at 10:46 pm

    Your $(‘.workexperience time.end[datetime=’ + end[end.length-1] + ‘]’) is collecting all jobs, while if I understand correctly it should only be scoped to the current job:

    $(this).find('time.end[datetime=' + end[end.length-1] + ']').clone()
    

    Fiddle: http://jsfiddle.net/jYnZy/14/

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

Sidebar

Related Questions

Hi i am trying to auto populate a 2d array based on user input.
I am trying to auto-populate a text field based on the value of another
I'm trying to auto-populate a drop down list based on a request parameter. I'm
I am trying to auto fill and submit the form using cURL, the code
I am trying to create auto-vectorized code with clang-3.2 From the slides here -
Im trying to get some auto complete to work. I have this URL i
I am trying to have a textBox auto complete with values from a database.
I am trying to use AJAX to populate some select boxes that were auto-generated
I'm trying to create an auto-complete box and have been having problems due to
i am trying to auto populate the latitude and longitude field in my forms

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.