0

Sorry the title is a bit missleading in what I want to ask actualy, but im unsure what I would have called it.
I have a list that you can add items too.
The list consists of a fiew things, but the one in question is a YEAR picker.

This works great ( to an extent ) thanks too https://stackoverflow.com/a/34677514/2240163

This bit of JQuery works fine for items created on load.

    $('.date-own').datepicker({
        minViewMode: 2,
        format: 'yyyy'
    });

This is what I was leaning towards, but its not working. To make the dynamically added items to react on the bellow.

    $('.date-own').on('datepicker',{
        minViewMode: 2,
        format: 'yyyy'
    });

Obviously its completely wrong or just needs a tweak, but im clueless.

morne
  • 4,035
  • 9
  • 50
  • 96

1 Answers1

0

Solution

    $('body').on('focus',".date-own", function(){
        $(this).datepicker({
            minViewMode: 2,
            format: 'yyyy'
        })
    })
morne
  • 4,035
  • 9
  • 50
  • 96