0

mobiscrollでonBeforeShowイベントを呼び出すにはどうすればよいですか?

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow:  
 });

表示される直前に時間を設定する必要があります。ドキュメントの準備ができているときにそれを行おうとすると、入力フィールドはまだ値で準備ができていません...

編集

私は試した:

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow: function(html, inst) {
            start = $('#starttime').val();
            var a = moment();
            var value = a.format('h:mm A');

            }
        });

しかし、エラーが発生します:'値が定義されていません'..。

4

1 に答える 1

2

コールバック関数を提供する必要があります。

$('#starttime').mobiscroll('setValue', value).time({
        theme: 'jqm',
        display: 'modal',
        mode: 'clickpick',
        stepMinute: 10,
        onBeforeShow: function (html, inst) {
            //Gets called before the scroller appears. The function receives the jQuery object containing the generated html and the scroller instance as parameters
        }
 });

http://docs.mobiscroll.com/23/mobiscroll-core

于 2013-01-12T02:31:44.163 に答える