问题描述
我在我的jQuery Mobile网页上使用DateBox2插件.
I am using the DateBox2 PlugIn for my jQuery Mobile webpage.
我从JSON Web服务获得以秒为单位的持续时间,该持续时间可以长达几天(例如86400s).
I get a duration in seconds from a JSON Webservice which can be as long as multiple days (e.g. 86400s).
我想使用标准的DateBox2持续时间显示将其发布到我的文本输入中,例如"1 Day,00:00:00",但我得到的只是秒数.
I want to post this in to my text input using the standard DateBox2 duration display like"1 Day, 00:00:00", but all I get is the plain seconds value.
我尝试了.val()、. datebox("setTheDate",86400)、. datebox(callFormat,...)的某些组合,但它们似乎都不起作用.
I tried some combinations of .val(), .datebox("setTheDate", 86400), .datebox(callFormat, ...) but none of them seem to work.
这是我的输入字段:
<input class='period' type='text' readonly='readonly' data-role='datebox' data-options='{"mode": "durationbox", "showInitialValue": true, "useFocus": true}' />
提前谢谢!
推荐答案
请谨慎使用:
$('element').trigger('datebox',{'method':'dooffset','type':'s','amount':86400}).trigger('datebox',{'method ':'doset'});
$('element').trigger('datebox', {'method':'dooffset', 'type':'s', 'amount':86400}).trigger('datebox', {'method':'doset'});
这篇关于如何在jQuery Mobile DateBox2中以编程方式设置DurationBox值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!