Skip to content

Switch between 12h/24h #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
enneston opened this issue May 16, 2012 · 0 comments
Open

Switch between 12h/24h #368

enneston opened this issue May 16, 2012 · 0 comments

Comments

@enneston
Copy link

Hi,

I've got a timepicker input and a selector:

<select id="field_timeFormat" name="fieldTimeFormat">
<option value="hh:mm a">hh:mm AM/PM(12 hours)</option>
<option value="HH:mm">HH:mm(24 hours)</option>
</select>

And I'd like to update timepicker and input on any change on selector. I wrote this code:

  $("#field_timeFormat").change(function(){
     var timeformat = $(this).val();
        if (timeformat == "hh:mm a"){
            $(".timepicker").timepicker({ampm:true })
        }else{
            //$(".timepicker").timepicker({});
            $(".timepicker").timepicker({ampm:false});
            }    
   });

But it doesn't work. Any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant