可以說我有兩個領域:如何在第二個字段中插入日期到第一個字段後插入日期?
Start Date: <input type="date" name=""/>
End Date: <input type="date" name=""/>
我希望當我在第一個字段中添加例如2014年3月12日添加日期到第二場後7天autoinsert(在這種情況下,它會10/12/2014)。
我會讓我的問題更清楚。
<title>Ha</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="jquery-ui.css">
<script src="jquery.min.js" type="text/javascript" ></script>
<script src="jquery-ui.js"></script>
<script>
$(function() {
$("#datepicker").datepicker();
});
$(function() {
$("#datepicker1").datepicker();
});
</script>
我使用jquery datepicker日曆。 這裏是我的領域:
<div class='ddate'><p>Start date:<input type="date" id="datepicker" name="d1" required="required"></p></div>
<div class='ddate'><p>End date:<input type="date" id="datepicker1" name="d2" ></p></div>
所以我應該使用一些JS函數或?
你有機會獲得如jQuery或任何角度圖書館?你試過什麼了?標籤絕對不應該具有'name'屬性的相同值,理想情況下應該具有'id'屬性。 – 2014-12-03 13:32:32
您嘗試使用哪些JavaScript代碼。 只需將轉換爲微秒的天數加上,就可以使用Date將日期添加到'StartDate'。即current_date + 7天* 24 * 60 * 60 * 1000。然後將其轉換爲新的Date對象。 – 2014-12-03 13:42:08
我編輯我的問題:) – lfc123 2014-12-03 13:47:35