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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:55:58+00:00 2026-06-09T03:55:58+00:00

I’ve got text entry box and a countdown on the same page. I want

  • 0

I’ve got text entry box and a countdown on the same page. I want to take the time from the box and enter it into the counter. I’ve got a variable back from the text box “setTime”. I wanted to put that directly into my timeSplit function (to convert the time into seconds) but when I do I get an error that “time.split is not a function”. What am I doing wrong here?

When I have a static variable enter the function (e.g. time = “12:12:12”) everything works perfectly. – except its not using the right time

When I run the pop up alert on setTime before the timeSplit function I see my time like this “12:12:12” so its coming from the counter without a problem and I don’t get a NaN error

Why would a time variable work when its static but not when its passed

I tried converting the setTime to a string but that just lead to NaN errors even when I tried to convert the sec variable back to an int.

I think this is the relevant code let me know if you need more.

var setTime = 0;
var $fromTime = $("#formEntry");

$("#setTime").off("click").on("click", function(){
  setTime = $fromTime.val();
});

function timeSplit(){
  //time = "12:12:12";
  tt = time.split(":");
  sec = tt[0]*3600+tt[1]*60+tt[2]*1;
  return sec;
}

var time = setTime;
//var time = "12:12:12";
var sec = timeSplit(time);
  • 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-09T03:56:00+00:00Added an answer on June 9, 2026 at 3:56 am

    Your function timeSplit() does not take any arguments. It needs to be timeSplit(time) so that JavaScript knows you are talking about calling the method .split() on an object called time rather than a function just called time.split().

    If this wasn’t just a typo (I’ve done that before), I suggest you read up some on function arguments and parameters so you know you understand how this works, it’s really important.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace

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.