I used a knockout.js templatescript to create a form that can be duplicated and deleted. The fiddle can be found here.
I editted the script with a litle help from SE
2 things:
like I said in the comments, use window.console.log (or a wrapper function) instead of console.log to prevent errors on older browsers who don't know the console object.
I use this (and many others) to autocorrect a field. In this case uppercase the input. This works excellent on the first form. But not on any duplicate forms.
replace:
$(".hoofdletters").keyup(function(e) { $(".hoofdletters").val(($(".hoofdletters").val()).toUpperCase()); });
with :
$(".hoofdletters").on('keyup', '#<some root element>', function(e) { $(".hoofdletters").val(($(".hoofdletters").val()).toUpperCase()); });
that way you guarantee that future elements receive the keyup handler
The root element is needed to limit the DOM monitoring scope for the on function. Ideally this would be a DIV
element
To change the date format, you can define a binding like this one:
data-bind='datepicker: beschikkingsdatum, datepickerOptions: {dateFormat: "dd/mm/yy"}, uniqueName: true'