Reputation: 1642
Need help implementing this DatePicker plugin for Phonegap. Maybe I'm missing something here, but I am totally lost as to what to do after adding the plugin to my project via CLI. The documented "usage" is not helping me out whatsoever.
With the following example html, what should be added for its hook?
<form>
<label for="user_name">Name</label>
<input name="user_name" type="text" id="user_name" placeholder="Name" />
<!-- what here?? -->
<input type="submit" value="Register" />
</form>
And using jQuery, how would I initialize it?
Repository: https://github.com/nicholasareed/cordova-plugin-datepicker/tree/007feae6393d7022af51d9a60055f7de4dd89e54
Thank you in advance for any information helping me resolve this.
Upvotes: 0
Views: 560
Reputation: 2815
You probably have to add servicing of your input. Usually you do it in separate *.js file.
Create test.js file in your project's www catalog and add it to youd index.html head section:
<html>
<head>
...
<script type="text/javascript" src="path-to-test/test.js">
</head>
<body>
...
</body>
In your test.js file add datePicker configuration:
var options = {
date: new Date(),
mode: 'date'
};
and onClick event handler (jQuerMobile example):
$('#idButton').on('click',function(){
// show picker
datePicker.show(options, function(date){
//get result
alert("date result " + date);
});
});
Upvotes: 1
Reputation: 1026
All modern phones (Android / iPhone) have support for the HTML5 input types. This will trigger the native date-selection. No need for complex datepicker-jquery-javascript magic anymore. Just try this:
<input type="date" name="mydate" />
And click the textfield on your phone.
Upvotes: 2