admin管理员组文章数量:1323335
I am getting error with jquery version:
<script src="js/Common/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src=".12.0/jquery-ui.js"></script>
My code is :
var storedData = '["08/11/2016","07/31/2016"]';
if( storedData !== null){
var eventDatesarray = JSON.parse(storedData);
var eventDates = [];
$.each(eventDatesarray, function( index, value ) {
var newdatepush = new Date(value);
eventDates.push(newdatepush);
eventDates[newdatepush] = newdatepush;
});
// An array of dates
// datepicker
jQuery('#ScheduleNextVisitCal').datepicker({
beforeShowDay: function( date ) {
var highlight = eventDates[date];
if(highlight) {
return [true, "event", highlight];
} else {
return [true, '', ''];
}
}
});
}
else
{
$( function() {
$("#ScheduleNextVisitCal" ).datepicker();
});
}
Problem statement :
i want to highlight specific date which i will get in "storedData" via jquery datepicker.
Surprise factor : //ajax.googleapis/ajax/libs/jquery/1.7.0/jquery.min.js //ajax.googleapis/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
if i am using these libs then my code work fine but somehow i can not change the libs
Error name : daySettings[2].replace is not a function
issue code :
same code with different libs working fine :
I am getting error with jquery version:
<script src="js/Common/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="https://code.jquery./ui/1.12.0/jquery-ui.js"></script>
My code is :
var storedData = '["08/11/2016","07/31/2016"]';
if( storedData !== null){
var eventDatesarray = JSON.parse(storedData);
var eventDates = [];
$.each(eventDatesarray, function( index, value ) {
var newdatepush = new Date(value);
eventDates.push(newdatepush);
eventDates[newdatepush] = newdatepush;
});
// An array of dates
// datepicker
jQuery('#ScheduleNextVisitCal').datepicker({
beforeShowDay: function( date ) {
var highlight = eventDates[date];
if(highlight) {
return [true, "event", highlight];
} else {
return [true, '', ''];
}
}
});
}
else
{
$( function() {
$("#ScheduleNextVisitCal" ).datepicker();
});
}
Problem statement :
i want to highlight specific date which i will get in "storedData" via jquery datepicker.
Surprise factor : //ajax.googleapis./ajax/libs/jquery/1.7.0/jquery.min.js //ajax.googleapis./ajax/libs/jqueryui/1.8.16/jquery-ui.min.js
if i am using these libs then my code work fine but somehow i can not change the libs
Error name : daySettings[2].replace is not a function
issue code : http://codepen.io/srawal/pen/KrBkVG
same code with different libs working fine : http://codepen.io/srawal/pen/grjoAx
Share Improve this question edited Jul 30, 2016 at 14:02 supersaiyan asked Jul 30, 2016 at 13:47 supersaiyansupersaiyan 1,7306 gold badges16 silver badges37 bronze badges 2-
What is
daySettings
& where is in your code ? – Abdennour TOUMI Commented Jul 30, 2016 at 13:52 - this issue with liberay : code here : codepen.io/srawal/pen/KrBkVG open the console > change month by arrow to september > daySettings[2].replace is not a function in console of browser – supersaiyan Commented Jul 30, 2016 at 13:59
1 Answer
Reset to default 12eventDates[ new Date( '09/04/2016' )] = new Date( '09/04/2016' ).toString();
eventDates[ new Date( '09/06/2016' )] = new Date( '09/06/2016' ).toString();
eventDates[ new Date( '09/20/2016' )] = new Date( '09/20/2016' ).toString();
eventDates[ new Date( '09/25/2016' )] = new Date( '09/25/2016' ).toString();
This works. Don't pass date into the array. It expects a string. Convert the date into string before putting it in the array. It works.
本文标签: javascriptdaySettings2replace is not a function jquery date pickerStack Overflow
版权声明:本文标题:javascript - daySettings[2].replace is not a function jquery date picker - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742136632a2422399.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论