I am using JQuery-Mobile datebox , and I want to set date input data-options using JQuery
edit:
my question is : how to set date input data-options using jquery ?
input code :
<input
name="mydate"
id="mydate"
type="date"
pickPageTheme="a"
data-role="datebox"
data-options='{"mode": "calbox" }' />
The datebox plugin internally relies on data() to parse the
data-optionsattribute, so you can use its setter form instead of creating an explicit attribute:Do not forget to refresh the widget afterwards if it’s already been created:
EDIT: Unfortunately, the code above won’t work if the datebox widget was automatically created by the mobile framework on page load (since the
data-optionsattribute is only parsed once). To work around that problem, you can use theoptionsmethod:In that case, however, you have to specify
highDatesAltbeforehighDates, or the former will be ignored.I updated your fiddle here.