I want to display the amount in the textbox based on the date selected.For weekdays amount is 200 on sundays amount is 500. How can I do it in jquery? Whether it is possible to do?
How can I do it in jquery?
<input type="date" name="mass_date" id="txtDate" required="required" class="col-md-12" />
<input type="text" class="form-control" id="slDay" name="amount" />
2
Answers
Use
getDay
. Add a event listener to to input change then each time the input changes create a new Date and then use thegetDay
function that returns the day number (0
for Sunday).Then you can put a conditional statement to change the
form-control
selector.A simple version