|
|
|
ช่วยด้วย อยากได้ bootstrap datepicker year (ปีพ.ศ. พุทธศักราช) |
|
|
|
|
|
|
|
Code (PHP)
<select name="year" id="year" class="form-control">
<option value="">:: Year ::</option>
<?php for($i=0; $i<=3; $i++) { ?>
<option value="<?php echo date("Y")-$i; ?>"><?php echo date("Y")-$i+543; ?></option>
<?php } ?>
</select>
|
|
|
|
|
Date :
2016-08-22 10:42:21 |
By :
littlebeer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (JavaScript)
<style>
.year-picker .ui-datepicker-calendar,.year-picker .ui-datepicker-month{display: none;}
</style>
<script>
$(function() {
$("#datepicker").datepicker({
changeYear: true,
showButtonPanel: true,
dateFormat: 'yy',
stepMonths: 12,
beforeShow: function(){
$("#ui-datepicker-div").addClass("year-picker");
},
onClose: function(dateText, inst){
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, 0, 1));
}
});
});
</script>
|
|
|
|
|
Date :
2016-08-22 13:22:32 |
By :
fossil31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|