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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:36:54+00:00 2026-06-10T07:36:54+00:00

HTML: <input type=radio name=timeformat id=timeformat-a value=am/pm checked=checked /> <b>am/pm</b> <input type=radio name=timeformat id=timeformat-b value=24

  • 0

HTML:

<input type="radio" name="timeformat" id="timeformat-a" value="am/pm" checked="checked" /> <b>am/pm</b> 
<input type="radio" name="timeformat" id="timeformat-b" value="24 hours" /> <b>24 hours</b>
        <select id="default-start-time" class="select check-list">
             <option value="" label="--Select--">--Select--</option>
             <option value="00:00" label="12:00 AM">12:00 AM</option>
             <option value="00:30" label="12:30 AM">12:30 AM</option>
             <option value="01:00" label="01:00 AM">01:00 AM</option>
             <option value="01:30" label="01:30 AM">01:30 AM</option>
             <option value="02:00" label="02:00 AM" selected>02:00 AM</option>
             <option value="02:30" label="02:30 AM">02:30 AM</option>
        </select>

When i choose the 24 hours format the option values should display.

jquery:

$("input[name='timeformat']").click(function() {
      if($(this).val()=='24 hours')
      {
         // code which replaces label with the option value       
      }
  });

How should the jquery look??

  • 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-10T07:36:55+00:00Added an answer on June 10, 2026 at 7:36 am

    If you have both a label attribute and text content in an <option> element the <label> will take priority.

    You can copy the values into the label like this:

    $('#default-start-time option').attr('label', function() {
         return this.value;
    });
    

    similarly you can copy the text content back into the label like this:

    $('#default-start-time option').attr('label', function() {
        return this.innerHTML;
    });
    

    See http://jsfiddle.net/alnitak/cLuZa/

    Note that (in Chrome, at least) neither will cause the control to change its current displayed value. They only appear when you click on the <select> element again. I’m still working on that…

    EDIT here’s my final answer:

    $("input[name='timeformat']").click(function() {
        var ampm = $(this).val() !== '24 hours';  // get mode
        var sel = $('#default-start-time')[0];    // get the <select> element
    
        $('option', sel).attr('label', function() {
            return ampm ? this.innerHTML : this.value;
        });
    
        sel.selectedIndex += 0;  // force refresh
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have HTML like this: <input type=radio name=type value=FL checked=checked />Fixed <input type=radio name=type
I have some HTML like this: <input type=radio class=MyRadio name=TheName> <label for=TheLabel>the text</label> How
<form action=1.html> <input type=radio id=check1 name=check /> <input type=radio id=check2 name=check /> </form> What
I have this HTML: <li> <input type=radio class=checkbox name=myName id=Id001/> One <img class=resetRadio src=star.png/>
So i have this: yes: <input type=radio value=Y id=SCvoteY name=vote></input> no: <input type=radio id=SCvoteN
Radio box code: <input type = radio name = choice value = A />Apples
Here is the code I am having: <div id=removequestions></div> var html += '<input type=radio
Is there a simple way to upload a single file through HTML input type
HTML has an input button type to reset all fields in a form to
I have an input on an HTML page where a person will type something

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.