I have in the layout file
<
script type="text/javascript">
$(function() {
// Datepicker
$('#passExp1').datepicker({
inline: true
});
});
</script>
In a view
<script type="text/javascript">
function addInput(divName) {
... code to add the new div with form fields...
newCalendar="passExp"+(counter+1);
newFunction(newCalendar);
}
</script>
how can I create a newFunction to call the newCalendar (which is the new form id) to add the datePicker to it?
I want to make it use the DatePicker for the new passExp2,passExp3,passExp4,passExp5,…
Since the value of the
newCalendarparameter is the id of the new div, you could do this in your function: