简体   繁体   中英

how put date range from week picker for two text input?

I'm new in javascript. I have week-picker from this link week-picker , but i dont know how i can put that date range for two text input?? start date - end date. ex. <input type="text" name='start_date' id="start_date"/> TO <input type="text" name="end_date" id="end_date"/>

Why not just do this:

<input type="text" name='start_date' id="start_date" data-weekpicker="weekpicker" />
<input type="text" name="end_date" id="end_date" data-weekpicker="weekpicker" />

You could try to just split the value from the week-picker input:

var range = document.getElementById("weekPickerInput").value;
var dates = range.split("-"); //Based on what divider you configured for the week picker

document.getElementById("startDateInput").value = dates[0];
document.getElementById("endDateInput").value = dates[1];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM