Sunday 15 June 2014

jquery dropdown select date picker and value from middle of list -


I have a jquery script that adds years as the option to select Menus.

How should it be configured so that the default value is 2001, but when you click on the arrow to select the menu, you big year since 2001, and get less.

What is the "Beach" list in 2001?

In the situation jsfiddle:

html:

  & span class = "label-f" & gt; Seit: & lt; / Span & gt; & Lt; Select class = "span2" id = "seit" name = "seit" & gt; & Lt; Option value = "2001" & gt; 2001 & lt; / Options & gt; & Lt; / Select & gt;   

Script

  $ (function () to {(i = new Date). GetFullYear (); i & gt; 1 9 00; i -) {$ ('# Seit'). Attached ($ ('& lt; option / & gt;') Val (i) .html (i));}});    

If you remove the added items through HTML and selected options after setting combo Do $ ('#seit'). Val ('2001')

HTML

  & lt; Span class = "label-f" & gt; Seit: & lt; / Span & gt; & Lt; Select class = "span2" id = "seit" name = "seit" & gt; & Lt; / Select & gt;   

JS

  $ (function () to {(i = new Date). GetFullYear (); i & Gt; 1900; i-) {$ ('#seat'). App ($ ('& lt; option / & gt;'). Val (i) .html (i));} $ ('# seit'). Val ('2001');});   



No comments:

Post a Comment