1
從bootstrap-timepicker24表單獲取文本值時遇到困難。從bootstrap-timepicker24獲取價值
JSP代碼:
<form action="#" class="form-horizontal form-bordered" id="shop-time">
<div class="form-body form" >
<div class="form-group">
<label class="control-label col-md-4">Monday</label>
<div class="col-md-4">
<div class="input-group shop-monday-open-time">
<input type="text" class="form-control timepicker timepicker-24">
<span class="input-group-btn">
<button class="btn default" type="button">
<i class="fa fa-clock-o"></i>
</button>
</span>
</div>
</div>
</div>
JS代碼:
// forms
var shopForm = $('#shop-time');
var shopMondayOpen = shopSave.find('.shop-monday-open-time');
// time picker listener
shopMondayOpen.on('changeTime.timepicker', function(open) {
var time = dateInUTC(open.time);
});
但該事件changeTime
不影響收聽。但是,如果我只是重新加載頁面,並在斷點處停止在這條線:var shopMondayOpen = shopSave.find('.shop-monday-open-time')
線和評估shopMondayOpen.val
在控制檯我得到的是這樣的:
shopMondayOpen.val
jquery.min.js:4 function (a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}
我試圖用timepicker-24 manual但沒有得到我遠..
猜猜我錯過了一些東西,但我無法弄清楚。
我剛剛已經意識到,我可以使用一個值straithg從CONTROLER,類似的東西: ' ' ' var time = $('shop-monday-open')。val' ..它適用於我。希望它能幫助別人。 –