I have the following javascript
$(document).ready(function(){
$.datepicker.setDefaults({
changeMonth: true,
changeYear: true,
dateFormat : 'yy-mm-dd',
inline : true,
});
var dateFields = ['non_fed_photo_id_exp_date', 'non_fed_id_exp_date', 'federal_photo_id_exp_date'];
$.each(dateFields, function(field){
$('#UserRegistration_user_'+field).datepicker({
yearRange: '<?php echo date('Y'); ?>:+30'
});
});
$('#UserRegistration_user_dob').datepicker({
defaultDate: '-20y',
yearRange: '-100:-15'
});
});
The UserRegistration_user_dob element is being properly assigned the datepicker but non of the fields in the array are.
Does anything stand out as to what I'm missing / done wrong?
$.each(dateFields, function(index, field) {first param is the index number...or simply add a css class like 'dpicker' and use that as the selector...