簡體   English   中英

DateBox Jquery移動擴展

[英]DateBox Jquery mobile extension

我試圖對日期框進行擴展,如果我首先需要選擇日期,然后單擊“選擇日期”。

一切順利,差不多。 當我單擊“選擇日期”按鈕時,將單擊模式窗口后面的內容,在我的情況下,這是一個搜索按鈕。

有人知道為什么嗎?

 if (o.useSelectDateButton) {
            $('<a href="#">Välj datum</a>')
                .appendTo(hRow).buttonMarkup({ theme: o.theme, icon: 'check', modal: true, iconpos: 'left', corners: true, shadow: true })
                .on(o.clickEvent, function(e) {
                    if ($(this).jqmData('enabled')) {
                        w.theDate.set(2, 1).set(1, $(this).jqmData('month')).set(2, $(this).jqmData('date'));
                        w.d.input.trigger('datebox', { 'method': 'set', 'value': w._formatter(w.__fmt(), w.theDate), 'date': w.theDate });
                    }

                    if (w.theDate == new Date()) {
                        w.theDate.set(2, 1).set(1, $(this).jqmData('month')).set(2, $(this).jqmData('date'));
                        w.d.input.trigger('datebox', { 'method': 'set', 'value': w._formatter(w.__fmt(), w.theDate), 'date': w.theDate });
                    }
                    w.d.input.trigger('datebox', { 'method': 'close' });
                });
        }

我這樣稱呼日期框:

 <input name="datepicker" id="datepicker" type="date" data-role="datebox" data-options='{"mode": "calbox", "calShowWeek": true, "overrideCalStartDay": 1, "useModal": true, "useAltIcon": true, "afterToday": true, "useFocus": true }'>

添加了JsFiddle Click for fiddle

問題是我無法在瀏覽器中重新創建問題,它僅在移動設備中發生。

你能用這個做些小提琴嗎?

另一個選項/替代:

看看這個

它是一個非常簡單的datetimepicker jQuery庫,並且很容易使用。

頭標簽:

 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});

身體標簽:

<p>Date: <input type="text" id="datepicker" /></p>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM