savsoft,
возможно вы хотели так
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
function getDates(date)
{ var arr = [];
date = new Date(date);
if(!date) return arr;
var days = 7;
date.setDate(date.getDate() + days);
var month = date.getMonth();
while (date.getMonth() == month) {
arr.push(dateFormat(date))
date.setDate(date.getDate() + days);
}
return arr;
}
function dateFormat(date)
{
return date.toISOString().replace(/T.+$/, "")
}
$("tr").on("click", ".btn-info", function(event) {
event.preventDefault();
var parent = event.delegateTarget;
var CliDate = $("[type='date']", parent).val();
var arrDate = getDates(CliDate);
$(parent).nextAll().find("[type='date']").val(function(i, v) {
return arrDate[i] === void 0? v : arrDate[i];
})
})
});
</script>
</head>
<body>
<form name="MyForm" id="myform" method="post" action="">
<table name="tablename" id="tablename" class="table table-striped table-bordered">
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Дата</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Company 1</td>
<td>
<input type="date" name="eventdate1" id="ed1" value="">
</td>
<td>
<button class="btn btn-info" >Вычислить</button>
</td>
</tr>
<tr>
<td>2</td>
<td>Company 2</td>
<td>
<input type="date" name="eventdate2" id="ed2" value="">
</td>
<td>
<button class="btn btn-info" >Вычислить</button>
</td>
</tr>
<tr>
<td>3</td>
<td>Company 3</td>
<td>
<input type="date" name="eventdate3" id="ed3" value="">
</td>
<td>
<button class="btn btn-info" >Вычислить</button>
</td>
</tr>
<tr>
<td>4</td>
<td>Company 4</td>
<td>
<input type="date" name="eventdate4" id="ed4" value="">
</td>
<td>
<button class="btn btn-info" >Вычислить</button>
</td>
</tr>
<tr>
<td>5</td>
<td>Company 5</td>
<td>
<input type="date" name="eventdate5" id="ed5" value="">
</td>
<td>
<button class="btn btn-info" >Вычислить</button>
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>