javascript - Dropdown goes off on selecting any field in date picker -
i have drop down in user can register. have date of birth field has date picker. when select in datepicker dropdown disappears.
js:
$( " #datepicker " ).datepicker ({ maxdate: 0, changemonth: true, changeyear: true, dateformat : 'dd-mm-yy', yearrange: '1955:2030' }); html:
<div class="row form-group" > <h6 class="lable">date of birth</h6> <input type="text" id="datepicker" placeholder="date of birth" name="dateofbirth" class="form-control text-field" required/> </div>
add below onselect , onclose functions have remain open (run snippet see work):
$("#datepicker").datepicker({ maxdate: 0, changemonth: true, changeyear: true, dateformat: 'dd-mm-yy', yearrange: '1955:2030', onselect: function () { $(this).data('datepicker').inline = true; }, onclose: function () { $(this).data('datepicker').inline = false; } }); <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <div class="row form-group"> <h6 class="lable">date of birth</h6> <input type="text" id="datepicker" placeholder="date of birth" name="dateofbirth" class="form-control text-field" required/> </div>
Comments
Post a Comment