Hey Guys,
Heres the issue I have. I’m unable to apply an event to a newly created input box. See below for the HTML.
[code=html]
<table style=”border:#666 solid 2px; border-collapse:collapse;” border=”2″ bordercolor=”#666″ width=”100%” id=”action”>
<thead>
<tr>
<td class=”tdtblf” width=”150px”><strong>Date / Time</strong></td>
<td class=”tdtblf” width=”240px”><strong>By Who</strong></td>
<td class=”tdtblf”><strong>Action</strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><input type=”text” id=”caldatetime” class=”caldatetime” value=”” /></td>
<td>John Doe</td>
<td><input type=”text” style=”width:450px” value=”” id=”actiondata” /></td>
</tr>
</tbody>
</table><br />
<p><div id=”add_row”><img src=”/img/create.gif” style=”margin-top:-2px; float:left” /> Add another entry</div></p>
jQuery lib is 1.7.1
Jquery:
[CODE]
//jQuery for Box Add Actions
$(‘#add_row’).click(function(){
if( $(‘#action tr:last-child input#caldatetime’).val().length > 0 && $(‘#action tr:last-child input#actiondata’).val().length > 0 ) {
$(‘#action tr:last-child input.caldatetime’).attr(“disabled”,”disabled”);
$(‘#action tr:last-child input#actiondata’).attr(“readonly”,”readonly”);
$(‘#action tr:last-child input.caldatetime’).removeClass(“caldatetime hasDatepicker”);
$(‘#action’).append(‘<tr><td><input type=”text” class=”caldatetime” id=”caldatetime” value=”” /></td><td>John Doe</td><td><input type=”text” id=”actiondata” style=”width:450px” /></td></tr>’);
}
});
//Calendar Callers
// And
//Function for appending fields
$(“.caldatetime”).live(“click”, function(){
$(this).datetimepicker({
dateFormat: ‘yy-mm-dd’,
timeFormat: ‘hh:mm:ss’,
stepHour: 1,
stepMinute: 2
});
});
Whats happening is when I create a new node I wish to click in the date box and bring up the datetime calendar picker I have placed on the page. It add the date thing to the first preset node correctly and I can add a new row(contains another input) and even click that second box and bring up the calendar fine. How ever when I select the box it changes the value in the first box only…
I have a feeling it to do with a selector I’m using. Any ideas?