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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:32:18+00:00 2026-05-15T07:32:18+00:00

I feel like this is a simple question, but I am still relatively new

  • 0

I feel like this is a simple question, but I am still relatively new to javascript and jquery.

I am developing a site for a touch interface that uses unordered lists and jquery .click functions to take input data. I have a section to input a m:ss time, with 3 divs, each containing a list of digits for time. I need to get the input for each column and set it as a variable. I originally designed the inputs to change form inputs, because I didn’t understand javascript very much. It was easy to change the 3 hidden inputs by using div id’s, but I can’t figure out how to do it now with javascript variables.

Here is my original jquery code…

$("div#time>div>ul>li").click(function() {
    var id = $(this).parents(".time").attr("name");
    var number = $(this).html();
    $("input#"+id).val(number);   });

The last line sets one of 3 hidden inputs equal to whatever was clicked. I need to make it so separate variables take the inputs, then I can manipulate those variables however I want.

Here’s a short snippet of the html, to have an idea of how jquery grabs it.

<div id="time">
  <h1>Time</h1>
  <div name="minute" class="time" id="t_minute">
  M :
     <ul>

The full time html is here: link text

Thanks everyone!

I’ve been using SO to answer many questions I’ve had, but I couldn’t find something for this, so I figured I would join, since I’m sure I will have more questions along the way.

So I have tried adding the following, and I still can’t get it to work right.

    window.myValues[id] = number;
event[i].min = myValues["minute"];
event[i].sec = myValues["second"];
event[i].sin = myValues["single"];
event[i].time = String(event[i].min) + String(event[i].sec) + String(event[i].sin);

I tried it both with and without the quotation marks. I have not used window.* for anything, so I’m not very sure how to handle this.

  • 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-15T07:32:19+00:00Added an answer on May 15, 2026 at 7:32 am

    First thing to mention here, don’t be unnecessary specific. In your example

    $('#time').find('li').click()
    

    should be enough.
    If I understand you well, you want to store the some data. You might want to use
    jQuery’s $.data method. Example:

    $('#time').find('li').click(function(){
        var $this = $(this);
        var name = $this.closest('.time').attr('name');
        $.data(document.body, name, $this.html());
    });
    

    This would store the html of the clicked li in a global Object, which can be accessed like

    alert($.data(document.body, 'minute'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like the answer to this question is probably very simple, but I'm
I feel like this is a rather simple question, but I can't seem to
I feel like this might be really simple but I'm just not getting it
I feel like there's a simple solution to this, but I'm not really sure
I feel like this is a dumb question and I'm missing something, but I
I feel like this is easy but I am missing something... Using jQuery, I
I feel like this is a stupid question, but I can't think of a
Sorry for the simple question but I feel like there's a smarter way to
I feel like this is a very noob question.. but I just can't get
This question seems to have been asked before, but I feel like my situation

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.