tags:

views:

20

answers:

0

I have a scenario I need to create a text box row dynamically with a date picker. The text box name should be same when creating a new row. Whenever I am doing this I am get into trouble. I could not execute and get the result. Without date picker, I am able to create a new row with multiple text boxes. When I am adding a text box, it is not working. Can anyone help me to resolve this issue? I am investigate over this issue since last week.

Here the code what I am using to create new row with date picker (dynamically).

if(x == "Since Timestamp" )
{       
var addRow = $(this).parent().parent();
var  newRow = $(this).parent().parent().clone(true);                    
if($(this).parent().parent().prev().attr('id') != null)
var myInput = ('<input type="text" id="days"  name="days" />');
//$(myInput).datepicker();
$(myInput).datepicker({dateFormat: 'mm-dd-yyyy',buttonImageOnly:true,showOn: 'button'});
$('td:eq(0)', newRow).html('<select name="cond3" id="cond3" class="dnr" disabled="true"><option>And</option><option>Or</option></select>'); 
$('td:eq(2)',newRow).html('');                                             $('td:eq(2)',newRow).html($(myInput));                                       $('td:eq(3)', newRow).html('<input type="text" name="datetime" id="datetime"   style="width:60px">');
//.append('HH:MM');
$('td:eq(3)', newRow).attr('style','width:120px');
newRow.find("select").val(x);   
$('select',newRow).each(function()
{            
 if( this.id == 'cond3' )
{              $(this).val(selectedval);                        
}
});                     
$(this).parent().parent().after(newRow);
$(this).parent().parent().remove();
return true;                        
}                   

This is the version of jquery I am using:

http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

I'm getting a "datepicker function undefined" error. Can anyone help?