How to clone a table row with a datepicker, using jQuery?

You need to do a couple of things. First, detach the datepicker fields before cloning the row (i.e. Inside the click handler).

Then re-initialize them after cloning the row. Right now you're only initializing the first one in the ready() handler when the page first loads, but the newly-cloned row needs to be initialized also.

You need to do a couple of things. First, detach the datepicker fields before cloning the row (i.e. Inside the click handler).

Then re-initialize them after cloning the row. Right now you're only initializing the first one in the ready() handler when the page first loads, but the newly-cloned row needs to be initialized also. I think the datepicker objects need to be detached before cloning because otherwise when you try to initialize the newly-cloned row, the plugin thinks it's already been initialized and aborts.

Also, you'll sometimes end up with multiple buttons or images next to the datepicker input fields if you don't detach them first. $(document). Ready(function () { $('#addNew').

Click(function () { // Detach all datepickers before cloning. $('. Datepicker').

Datepicker('destroy'); var tbody = $('#entries tbody'); var rows = tbody. Find('tr'). Length; var newRow = tbody.

Find('tr:first'). Clone(true). AppendTo(tbody); newRow.

Find(':input'). Val(''). Each(function () { var id = this.Id if (id) { this.

Id = this.id. Split('_')0 + '_' + rows; } }) // Reattach all datepickers after cloning. $('.

Datepicker'). Datepicker({ autoSize: true, changeMonth: true, changeYear: true, gotoCurrent: true, showOn: 'both', buttonImage: '@Url. Content("~/Content/calendar.

Png")', buttonText: 'Choose Treatment Date', NextText: 'Next', prevText: 'Previous', showButtonPanel: true }); }); // Initial datepicker setup on page load. $('. Datepicker').

Datepicker({ autoSize: true, changeMonth: true, changeYear: true, gotoCurrent: true, showOn: 'both', buttonImage: '@Url. Content("~/Content/calendar. Png")', buttonText: 'Choose Treatment Date', NextText: 'Next', prevText: 'Previous', showButtonPanel: true }); }).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions