简体   繁体   English

Gijgo Datepicker上个月和下个月的图标更改

[英]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. 我试图改变previousnext一个月图标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.

相关问题 jQuery Datepicker从当前月份删除上个月或下个月的日期 - Jquery Datepicker remove days of previous or next month from the current month 如何在日期选择器中显示下一个和上一个月的名称,而不只是箭头&lt;,&gt; - How to show next and previous month names in datepicker instead of just arrows <,> 单击上一个/下一个月时,阻止jQuery Datepicker刷新 - Stop jQuery Datepicker from refreshing when clicking previous/next month 如何在Bootstrap日期选择器中获得下个月上个月而不是下一个上一个图标? - How to get next month Previous month in Bootstrap date picker instead of next previous icon? 使用 Bootstsrap Jquery 在 datepicker 中将下个月和上个月替换为下个月和前一天 - Replace Next and Previous Month by Next And previous Day in datepicker using Bootstsrap Jquery 在下一个日期选择器中禁用 - Disable next month in datepicker 如何在gijgo中更改&#39;paramNames&#39;? - How to change 'paramNames' in gijgo? 在Meteor中找不到Gijgo字体图标 - Gijgo font icon not found in Meteor 从上个月的日期选择器中删除最后几天 - Remove the last days from the previous month datepicker 如何在datepicker中禁用先前选定的月份 - how to disable previous selected month in datepicker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM