如何在jQuery Mobile DateBox2中以编程方式设置DurationBox值?

时间:2013-09-23 13:33:20

标签: javascript jquery jquery-mobile mobile datebox

我在我的jQuery Mobile网页上使用DateBox2 PlugIn。

我从JSON Webservice获得持续时间,持续时间可以长达数天(例如86400秒)。

我想使用标准的DateBox2持续时间显示将其发布到我的文本输入中 “1天,00:00:00”,但我得到的只是普通的秒值。

我尝试了.val(),. datebox(“setTheDate”,86400),。datebox(callFormat,...)的一些组合,但它们似乎都没有用。

这是我的输入字段:

<input class='period' type='text' readonly='readonly' data-role='datebox' data-options='{"mode": "durationbox", "showInitialValue": true, "useFocus": true}' />

提前致谢!

1 个答案:

答案 0 :(得分:1)

请使用:

$('element')。触发器('datebox',{'method':'dooffset','type':'s','amount':86400})。trigger('datebox',{'method ':' doset'});