English 中文(简体)
选择时 jj 查询日期选择器多重
原标题:jQuery datepicker multiple onSelect

我有两个关于选择功能的功能, 两者都是单独工作, 但能否合并起来? 第一个函数转换一个从 DateTime 转换为 TimeSTAMP 格式的替代字段。 第二个函数限制 UI 中可选择的天数 。 我想我要为每个字段选择两个函数, 但我找不到语法 。 任何帮助都会受到欢迎!

转换为时间STAMP :

$( #start_date ).datepicker({
            inline: true,
            altField:  input[name="event_start_date_min"] ,
            altFormat:  @ ,
            onSelect : function(dateText, inst){
                    var epoch = $.datepicker.formatDate( @ , $(this).datepicker( getDate )) / 1000;
                    $( input[name="event_start_date_min"] ).val(epoch);
            }
        });
        $( #end_date ).datepicker({
            inline: true,
            altField:  input[name="event_start_date_max"] ,
            altFormat:  @ ,
            onSelect : function(dateText, inst){
                    var epoch = ($.datepicker.formatDate( @ , $(this).datepicker( getDate )) / 1000)+(60*60*24);
                    $( input[name="event_start_date_max"] ).val(epoch);
            }
        });

限制日期:

$(document).ready(function(){
                $("#start_date").datepicker({
                    minDate: 0,
                    onSelect: function(selected) {
                      $("#end_date").datepicker("option","minDate", selected)
                    }
                });
                $("#end_date").datepicker({ 
                    minDate: 0,
                    onSelect: function(selected) {
                       $("#start_date").datepicker("option","maxDate", selected)
                    }
                });  
            });
最佳回答

你试过把它们拼凑在一起吗?

$(document).ready(function(){

    $("#start_date").datepicker({
        minDate: 0,
        onSelect: function(dateText, inst) {
            $("#end_date").datepicker("option","minDate", dateText)

            var epoch = $.datepicker.formatDate( @ , $(this).datepicker( getDate )) / 1000;
            $( input[name="event_start_date_min"] ).val(epoch);
        }
    });

    $("#end_date").datepicker({ 
        minDate: 0,
        onSelect: function(dateText, inst) {
            $("#start_date").datepicker("option","maxDate", dateText)

            var epoch = ($.datepicker.formatDate( @ , $(this).datepicker( getDate )) / 1000)+(60*60*24);
            $( input[name="event_start_date_max"] ).val(epoch);
        }
    });  
});
问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签