G
G
Guser112019-03-10 19:32:02
CMS
Guser11, 2019-03-10 19:32:02

How to make option selection in select based on date in input in JS?

Good evening. I need pro help!
There is a field with a choice of status:

<select id="opta">
<option id="now">Now</option>
<option id="other">Other</option>
</select>


And there is an input field:
<input type="text" name="xfdate" placeholder="дд.мм.гггг" id="xfdate" value="" rel="essential">

A calendar is attached to the input field (a date is selected and it fits) DatePicker.js Please help me

make a js script that would automatically select the status depending on the specified date in the input.
If a future date (from the present time) is specified, then "other" is automatically selected in the select.
But if the current date or the past date is specified, now is automatically selected

. Weak in js. I did not find anything similar on the Internet, they advised me to write here.
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Epikhin, 2019-03-10
@Guser11

What DatePicker.js are you talking about? Can you send a link to this script? Is it Jquery UI Datepicker ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question