javascript - I am trying to get current date with form select option and display next seven days on submit -


If current date is 3/11/14 and user raises on Wednesday 3/12/14, 3/19 / 14, 3/26/14, 4/2/14, 4/9/14, 4/16/14 should be printed.

HTML

  & lt; Div class = "farm group" & gt; & Lt; Select ID = "Select" placeholder = "week's favorite day" & gt; & Lt; Option selected = "selected" & gt; & Lt; / Option & gt; & Lt; Option value = "1" & gt; Monday & lt; / Options & gt; & Lt; Option value = "2" & gt; Tuesday & lt; / Options & gt; & Lt; Option value = "3" & gt; Wednesday & lt; / Options & gt; & Lt; Option value = "4" & gt; Thursday & lt; / Options & gt; & Lt; Option value = "5" & gt; Friday & lt; / Options & gt; & Lt; Option value = "6" & gt; Saturday & lt; / Options & gt; & Lt; Option value = "7" & gt; Sunday & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; JAVASCRIPT $ (document) .ready (function () {var current data = new date (); $ ("select #"). Val (current date .getDate ());});    

Try this one

  $ (document) ) .ready (function () {$ ("# selectDay"). change (function () {var day = parseInt ($ ("# selectDay"). Val (); Var current data = new date (); var offset = Current date .getDay () & lt; days? 0: 7; var adidis = days + offset - for current date .getDay (); (var i = 0; i <4; i ++) {current Date (date == 0) {addDays = 7}}}}}};    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -