Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.javascript
displaying specified div in order based on clicking dynamically displayed dates with jquery/javascript
aetagothno
1/21/2016 3:29:00 AM
Here is my code:
http://js.do/jane...
I have predefined div's, each are going to contain different content and styles. I want to have a user enter a start date, and then restrict the end date so they can choose up to 7 days. I have been having a problem implementing the date restriction, I try doing "+7d" for max Date but for some reason it doesn't limit it correctly, it is always showing more than the amount I specify.
So say the user chooses a date range, with 7 days total. The date range appears below. If the user clicks on the first date, the content within the first div is supposed to be displayed only. The next date that is clicked the content in the second div is displayed only, and so on. So div1 maps to first date.. div7 will map to 7th date if there is a seventh date. I thought of trying to do this with next() but this did not work, now when I run the code and select a date it opens the whole set of divs for each selected date rather than the single intended div.
What is the best way to go about achieving this?
3 Answers
Evertjan.
1/22/2016 2:13:00 PM
0
aetagothno@gmail.com wrote on 21 Jan 2016 in comp.lang.javascript:
> Here is my code:
http://js.do/jane...
Oh please why all this JQuery, you will never learn Javascript that way.
> I have predefined div's, each are going to contain different content and
> styles. I want to have a user enter a start date, and then restrict the
> end date so they can choose up to 7 days. I have been having a problem
> implementing the date restriction, I try doing "+7d" for max Date but
7 days is aDate to aDate + 6 days, not + 7 days.
var aDate =
new Date(2016,0,22);
var lastDate =
new Date(aDate.getFullYear(), aDate.getMonth(), aDate.getDate() + 6);
> for some reason it doesn't limit it correctly, it is always showing more
> than the amount I specify.
Stands to reason, see above.
> [..]
> What is the best way to go about achieving this?
Silly presumption, that there must be a "best" way,
unless perhaps it learning proper Javascript.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aleksandro
1/22/2016 2:55:00 PM
0
On 22/01/16 11:12, Evertjan. wrote:
> aetagothno@gmail.com wrote on 21 Jan 2016 in comp.lang.javascript:
>
>> Here is my code:
http://js.do/jane...
>
> Oh please why all this JQuery, you will never learn Javascript that way.
$($(come).on(this).it($("not"), $((so.bad)) || isnt.it ? lol:lol))
Evertjan.
1/22/2016 3:38:00 PM
0
Aleksandro <aleksandro@gmx.com> wrote on 22 Jan 2016 in comp.lang.javascript:
> On 22/01/16 11:12, Evertjan. wrote:
>> aetagothno@gmail.com wrote on 21 Jan 2016 in comp.lang.javascript:
>>
>>> Here is my code:
http://js.do/jane...
>>
>> Oh please why all this JQuery, you will never learn Javascript that way.
>
> $($(come).on(this).it($("not"), $((so.bad)) || isnt.it ? lol:lol))
If someone cannot count 7 days in Javascript,
trying to do it in JQuery, well ...
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
displaying specified div in order based on clicking dynamically displayed dates with jquery/javascript
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password