开发者

JQuery Datepicker needs to fire onclick

I need to fire the jquery datepicker from a link click. Right now if i click on the textbox the datepicker opens which is great but i have a button next to the textbox that someone can click and it needs to open the datepicker next to it. Also I would like a label instead of a textbox, is that possible. The code is below:

$(document).ready(function(){
   $("#mydate").datepicker({ maxDate: '+1y', minDate: new Date() }开发者_C百科);

});

   <li class="quick_date"><%= text_field_tag "mydate", Date.now.strftime('%m/%d/%Y'), :size => 10 %> <a id="quick_search" href="#">(Change Me)</a></li>


To make the #quick_search link open the datepicker you can do this:

var mydate = $("#mydate").datepicker({ maxDate: '+1y', minDate: new Date() });
$("#quick_search").click(function(){
    mydate.datepicker("show");
});


try

.datepicker({ showOn: 'button'})


// datefields
$('.datefield').click(function(e){
var datefield = $(this).datepicker({
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-mm-dd'
 }).unbind('blur focus');
datefield.datepicker('show');
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜