1

私は今、ブートストラップ 3.0 と eternicode の bootstrap-datepicker を使用して、この入力に取り組んでいます。

問題は、ユーザーが手で日付を変更したくないため、デフォルトで入力が無効になっていることです。

日付ピッカーを表示するために、カレンダーのグリフィコンを含む入力アドオンを割り当てています。問題は、日付を選択するたびに、入力が日付を受信しないことです。私はドキュメントを調べてきましたが、それを行う方法がありますが、それは Bootstrap 2.3.2 のみです。

これが私のコードです。選択した日付を日付ピッカーから無効な入力に転送する方法を知っている人はいますか?

助けていただければ幸いです。

html

<div class="form-group">
     <label class="control-label" for="fechaTandas">Fecha</label>
      <div class="input-group">
     <span class="input-group-addon date" id="trigger-datepicker"><span class="glyphicon glyphicon-calendar"></span></span>
   <input type="text" class="form-control" name="fechaTandas" disabled="disabled" id="fechaTandas" placeholder="seleccione una fecha">
 </div>

js

//JS to trigger the datepicker
$('#trigger-datepicker').datepicker({
     format: "yyyy/mm/dd",
    language: "es"    
});

これは、eternicodes datepicker プラグインへのリンクです。

http://eternicode.github.io/bootstrap-datepicker

4

1 に答える 1

1

DatePickerの変更イベントを処理する必要があると思います..

  $('#trigger-datepicker').datepicker()
    .on("changeDate", function(e){

      $('#fechaTandas').prop('disabled',false);
      $('#fechaTandas').val(e.format('yyyy/mm/dd'));
      $('#fechaTandas').prop('disabled',true);

  });

デモ: http://bootply.com/88516

于 2013-10-18T13:41:28.337 に答える