bootstrap daterangepicker open by button

se88 picture se88 · Mar 4, 2015 · Viewed 9.5k times · Source

i use the bootstrap daterangepicker (dangrossman) and Bootstrap 3. Now i want does i can the daterangepicker open with a addon-button and with clickling in the input field

my code:

<div class="form-group">
        <div class="input-group input-group-sm">
            <span class="input-group-btn">
                <button class="btn btn-default" type="button"><span class="glyphicon glyphicon-calendar"></span></button>
            </span>
                <input id="daterangepicker" class="form-control" type="text" name="daterangepickerDisplay">
        </div>
    </div>

This works.. but only when i click in the inputfield..

Answer

Dhivya picture Dhivya · Apr 22, 2015

This worked for me:

$('#my-input').data('daterangepicker').toggle();