开发者

AM PM Time picker Code needed

开发者 https://www.devze.com 2023-02-27 00:19 出处:网络
I dont want to use HTML drop down for AM PM time picker in 12 hours format...can any one give 开发者_开发技巧me LInk regarding this.I want Jquery/Javascript/CSS based AM PM pickerHere is a solution th

I dont want to use HTML drop down for AM PM time picker in 12 hours format...can any one give 开发者_开发技巧me LInk regarding this.I want Jquery/Javascript/CSS based AM PM picker


Here is a solution that does what you want, though tbthorpe is right, it might be good to make the two spans I use into radio buttons, and style those so they work the same as my solution.

http://jsfiddle.net/csaltyj/PPQQ8/

What you could do is, have radio buttons with a class on it, and use jQuery to hide those and replace them with the clickable spans which actually trigger the radio button clicks. Probably a better solution for accessibility.


Here's a more robust time picker than just AM/PM - it's a jQuery plugin. Presumably, you could pare down the js/css and have it just let you pick am or pm.

http://fgelinas.com/code/timepicker/


I found this trying to find a decent time picker which supports US AM/PM style and doesn't use a drop down. The best tool for me was anytime. http://www.ama3.com/anytime/

example code (assuming you have loaded jQuery and the AnyTime script)

$("#field2").AnyTime_picker( {
    format: "%h:%i %p",
    labelTitle: "Time",
    labelHour: "Hour",
    labelMinute: "Minute"
} );

supporting html

<input type="text" id="field2" value="" readonly="">

Example fiddle:

http://jsfiddle.net/brianlmerritt/Lzn7fnnw/2/

And it looks like this...

AM PM Time picker Code needed

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号