简体   繁体   中英

DateBox Jquery mobile extension

I was trying to make a extension of datebox were I first needed to select the date and then click "Choose date".

All works, well almost. When I click the "Choose date" button the content behind the modal window get clicked, and in my case it is a search button.

Anyone know why?

 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' });
                });
        }

I call the datebox like this:

 <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 }'>

Added a JsFiddle Click for fiddle

The problem is that i cant recreate the problem in the browser, it only happens in a mobile device.

can you make fiddle with this?which jquery libraries you use for this?

An another option / alternative:

Take at look at this

its a very simple datetimepicker which jquery libraries and it is very simple to put this to work.

head tag:

 <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();
});

body tag:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM