jQuery datepicker onSelect set multiple row values
On the select event of the datepicker I need to add and set values in multiple rows. In other words, I have something like this...
Days Value
Row 1 7
Row 2 2
Row 3 3
I have the "Days" and "Value" columns as textboxes. When I select a date from the datepicker I need to add the "Days" value for each row to the date selected. That value is what goes into the "Value" column. Example, I select 4/20/2010. The value in each respective row would then be 4/28/2010, 4/22/2010, 4/23/2010.
Hopefully this makes sense and thank you for the help in advance.
EDIT -------
Luis, I've tried implementing your code with what I had and have a question. I select开发者_运维百科ed from my datepicker 4/21/2010. So the first row, in my example above, should be 4/28/2010. I'm not getting that though. It's returning 11/3/2010. Can you or someone help me please with understanding why. Thanks.
Thank you for the update. It was helpful.
say you have an input filed with an id of datePicker adn the table has an id of myTable:
$("#myTable tr").each(
function() {
var calcDate = new Date($("#datePicker").val());
calcDate.setDate(calcDate.getDate() + parseInt($(this).find("td:eq(0)").text()));
var formatDate = (calcDate.getMonth() + 1) + "/" + calcDate.getDate() + "/" + calcDate.getFullYear()
$(this).find("td:eq(1)").text(formatDate);
}
);
精彩评论