I have a field that requires the user to select year only from a datepicker.
The picture above displays it correctly. But when I cloned the fields the year picker now displays the datepicker which displays the day, month and year format. Like this:
How can I set it back in displaying the year picker in the cloned fields? This is my jquery for cloning the fields.
$(document).ready(function() {
var newRow = $("#collegeField").clone();
$('.yrpicker').datepicker
$("#collegebtn").on("click", function() {
newRow.clone().appendTo("#collegeField").find(".yrpicker").datepicker();
});
});
<div class="form-group col-md-1">
<label for="college_school">Started</label>
<input type="text" class="form-control datepicker yrpicker" name="yrStarted" id="yrStarted" placeholder="From">
</div>
<div class="form-group col-md-1">
<label for="college_school">Graduated</label>
<input type="text" class="form-control datepicker yrpicker" name="yrGrad" id="yrStop" placeholder="To">
</div>