0

I'm using standard JQM date picker with input tag like this

<input type="date" data-clear-btn="false" id="dp" value="2006-09-14">

on request here is jsfiddle example: http://jsfiddle.net/GardenOfEmuna/47VUw/

Now I want to display value in a trigger button and open datepicker upon clicking on it.

Has anyone idea how to open datepicker with a trigger button?

Daniel
  • 1,364
  • 1
  • 11
  • 18

1 Answers1

1

You are not using a jqm datepicker, since there is none. You are using the native browser datepicker control and you can't trigger it as proved in this thread

Possible solution:

I've created a jsFiddle, it uses the datepicker from jquery ui with a wrapper class as shown in the jqm documentation (link)

html

<div data-role="page" id="foo">
    <div data-role="content">
           <input id='myDatePicker' type="text" data-role="date">
           <button id='myButton' class="ui-btn">Button</button>   
    </div>
</div> 

js

$(document).on('pageinit',function(){
    $('#myButton').click(function() {
        $('#myDatePicker').datepicker( "show" );
    });
});

resources

  • jquery.mobile-1.4.2.min.css
  • jquery-1.9.1.min.js
  • jquery.mobile-1.4.2.min.js
  • jquery.ui.datepicker.js
Community
  • 1
  • 1
tronc
  • 683
  • 4
  • 12
  • 23