Jquery UI Date picker – syntax error dateFormat: ‘dd-mm-yy’

Recently we have used Jquery UI Date picker for a car booking site. but it was showing error in internet explorer in Win XP, it was working perfectly in all other browser.

Code we used:

<script type=”text/javascript”>
$(function() {
$(“#datepicker1”).datepicker({
showOn: ‘both’,
buttonImage: ‘<?php bloginfo(‘template_directory’); ?>/datepicker/css/images/cal.jpg’,
buttonImageOnly: true,
dateFormat: ‘dd-mm-yy’,
});
});

$(function() {
$(“#datepicker2”).datepicker({
showOn: ‘both’,
buttonImage: ‘<?php bloginfo(‘template_directory’); ?>/datepicker/css/images/cal.jpg’,
buttonImageOnly: true,
dateFormat: ‘dd-mm-yy’,
});
});
</script>

 

and after searching and budding we have found that we have used comma(,) in last config line. which was dateFormat: ‘dd-mm-yy’,

and removing comma(,) solved the problem.. and it works greatly in all versions of IE.

the final code was:

<script type=”text/javascript”>
$(function() {
$(“#datepicker1”).datepicker({
showOn: ‘both’,
buttonImage: ‘<?php bloginfo(‘template_directory’); ?>/datepicker/css/images/cal.jpg’,
buttonImageOnly: true,
dateFormat: ‘dd-mm-yy’
});
});

$(function() {
$(“#datepicker2”).datepicker({
showOn: ‘both’,
buttonImage: ‘<?php bloginfo(‘template_directory’); ?>/datepicker/css/images/cal.jpg’,
buttonImageOnly: true,
dateFormat: ‘dd-mm-yy’
});
});
</script>