jquery datepicker is always visible

0

I'm trying to use the jquery datepicker, but every time I create it it always pops up, as if it had statically there. Example of what is happening, and not appearing only when I click. link

    
asked by anonymous 26.05.2017 / 21:05

2 answers

0

Edited / corrected: I forgot to edit the fiddle link.

Maybe using an input instead of the span tag will work. example: link

  

html:

<input type="text" id="test" maxlenght="10">
  

js:

$("#test").datepicker();
    
26.05.2017 / 21:08
0

As Diego Andrade punctuated me, if you use an input everything happens correctly. So I solved the situation as follows link

I have an input within the span, I will keep this input hidden

<span id="test">
   <input id="datepicker" type="text">
   bla
</span>

And I'll use the following localization in javascript

$("#datepicker").datepicker();
$("#datepicker").hide();

$("#test").click(function(){
    $("#datepicker").show().focus().hide();
});

Every time the span is clicked, the datepicker will open

    
26.05.2017 / 21:39