jquery - How to use datepicker Dynamically -


I have these input boxes, now how can I use dynamically dynamically

 < code> & lt; Input type = "text" id = "datepicker" name = "date [0]" & gt; & Lt; Input type = "text" id = "datepicker" name = "date [1]" & gt; & Lt; Input type = "text" id = "datepicker" name = "date [2]" & gt; & Lt; Input type = "text" id = "datepicker" name = "date [3]" & gt;   

I tried to do something like that, but it does not work only for the first input changes

  $ ('name =' "date" )   

I would not like to dynamically like this code

  Code> $ ('# datepicker1') datepicker ({}) $ (' # Datepicker2 ') datepicker ({}) ....   

Is this possible? Thanks for any answers.

For this case, you should use a class instead of ID:

  & lt; Input type = "text" class = "date picture" name = "date [0]" & gt; & Lt; Input type = "text" class = "datepicker" name = "date [1]" & gt; & Lt; Input type = "text" class = "datepicker" name = "date [2]" & gt; & Lt; Input type = "text" class = "datepicker" name = "date [3]" & gt;   

Then you can call datepicker for each element only with this class:

  $ ('datepicker') datepicker ({dateFormat: 'Yy -mm-dd', change title: true, changing year: true})    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -