[英]Gijgo Datepicker previous and next month icon change
I am using Gijgo Datepicker. 我正在使用Gijgo Datepicker。 i am trying to change the
previous
and next
month icon to icomoon icons but i didn't find any solution to it. 我试图改变
previous
和next
一个月图标icomoon图标,但我没有找到任何解决的办法。 for the icon to the right in the input field, there is the option 对于输入字段右侧的图标,有一个选项
icons: {
rightIcon: '<i class="icon-calendar_today"></i>'
},
but not for next or prev month. 但不适用于下个月或上个月。
here is the sample code. 这是示例代码。 i need to change https://tppr.me/V77Wu this to
<i class="icon-right"></i>
like this. 我需要像这样将https://tppr.me/V77Wu更改为
<i class="icon-right"></i>
。
$('.datepicker').datepicker({ uiLibrary: 'bootstrap4', iconsLibrary: 'glyphicons', format: 'mmmm d yyyy', value: 'April 11th 2019', icons: { rightIcon: '<i class="icon-calendar_today"></i>' }, change: function(dateText, inst) { var date = dateText.target.value.split(' '); var day = date[1]; var suffix = ""; switch(day) { case '1': case '21': case '31': suffix = 'st'; break; case '2': case '22': suffix = 'nd'; break; case '3': case '23': suffix = 'rd'; break; default: suffix = 'th'; } var altDay = date[1] + suffix; date[1] = altDay; var newDate = date.join().replace(/,/g, " "); $(".datepicker").val(newDate); } });
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <link href="https://unpkg.com/gijgo@1.9.13/css/gijgo.min.css" rel="stylesheet"/> <script src="https://unpkg.com/gijgo@1.9.13/js/gijgo.min.js"></script> <input type="text" class="form-control datepicker">
This is with js simply. 这是简单的js。 A way of doing it.
一种方法。 Hope it helps.
希望能帮助到你。 You could also use jQuery since you already use that.
您也可以使用jQuery,因为您已经在使用它。
It replaces the first element with the class 'glyphicon-chevron-right' here, maybe better to target it with jquery. 它在这里用类'glyphicon-chevron-right'替换了第一个元素,也许最好用jquery定位它。
var e = document.getElementsByClassName('glyphicon-chevron-right')[0]; var d = document.createElement('i'); d.innerHTML = e.innerHTML; e.parentNode.replaceChild(d, e); d.classList.add("icon-calendar_today");
<span class="glyphicon glyphicon-chevron-right"></span>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.