Datepicker and new rows..
Hey Guys,
I've got this code:
- $('.datepicker').hover(function(){
- $(this).datepicker({
- dateFormat: 'dd-mm-yy'
- });
- });
-
- $('.addrow').click(function(){
- $('#tableform tbody>tr:last').clone(true).insertAfter('#tableform tbody>tr:last').show("slow");
- $('#tableform tbody>tr:last input').val('');
- totalrows++;
- });
I basically have a table where the user can add an extra row to input data, that all works fine, the issue that I have is with the datepicker. When i've loaded the page, I can add a number of rows to the table and each input with the class 'datepicker' will display the datepicker. But if i add a row after I have already 'picked a date on another row' when clicking on the newly added input it will only display the datepicker on the last input in the table before clicking to add a new row (so the row above), and if i add another row and click on the new input it will only show the datepicker on the last row that was originally there the first time I ever loaded the datepicker (two rows above).
Any ideas how i can get around this?
Thanks.