Strange behavior in Material datepicker

I am trying to use google manize date picker ( http://materializecss.com/forms.html ). That being said, I want to pop up on date selection when I click on the icon. I have implemented two implementations where the only difference between them is to deliver alert('clicked')

with code.

withoutalert('clicked')

: http://jsfiddle.net/1bnnkhbw/

fromalert('clicked')

: http://jsfiddle.net/1bnnkhbw/1/

The second one works until the first one ... (in chrome) !!!

Does anyone know the reason for this behavior?

And how to do the 1st job?

+3


source to share


1 answer


I think I found a solution for you man, check this:

<i id="icon">click</i>
<input class="datepicker" style="display:none;" value="click"></input>



$('.datepicker').pickadate({
    selectMonths: true,
    selectYears: 15 
  });

$('#icon').click(function(event){
    event.stopPropagation();
    $(".datepicker").first().pickadate("picker").open();
    console.log("test1");
});

      



Fiddle: http://jsfiddle.net/k2qtzp7p/1/

Code taken from here and here

+5


source







All Articles