开发者

jquery UI datepicker put button before the field

开发者 https://www.devze.com 2023-04-12 22:53 出处:网络
Is it possible to have the button that pulls up the calendar in the JQuery UI开发者_运维百科 datepicker before the input field? By default it is always put after the field. I tried isRTL: true but tha

Is it possible to have the button that pulls up the calendar in the JQuery UI开发者_运维百科 datepicker before the input field? By default it is always put after the field. I tried isRTL: true but that also changes the prev/next buttons in the calendar.


There are at least two ways to achieve this. One is as described by JMax. The other one is simply move the icon before the input box:

$( "#datepicker" ).datepicker({
    ...
    buttonImage: "path/to/icon.png"
}).next().insertBefore('#datepicker');

See this in action: http://jsfiddle.net/william/rrcmq/1/.


If what you want is to put a button that triggers the calendar like this example but on the left, you can easily add a button on your own and bind it an event:

$("#mybutton").click(function() {
  $("#datepicker").datepicker( "show" )
});
0

精彩评论

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

关注公众号