hey guys I have two divs- with id=”form1″ which is inline and the other with id=”form2″ which gets its content through ajax(where the div tag is mentioned on the same page).
<div id="form1">
.
.form content
.
.
</div>
<div id="form2"> //gets content dynamically
Now, I have used the following datepicker code-
$(function() {
$( "#datepicker,#datepicker1" ).datepicker({ dateFormat: 'yy-mm-dd' });
});
Now, I have applied the datepicker id to a field in form1 and it works perfectly.
The problem is in the second form. The second form gets generated by loop and i have used the following logic to apply the id datepicker1 to it-
<? foreach ($list as $key => $value): ?>
<? $dt='';
if($key=='date_of_purchase'){
$dt="datepicker1";
}?>
<tr><td><?= $key ?> :</td><td><input id="<?=$dt;?>" type="text" name='<?= $key ?>' size="25" value='<?php echo $value; ?>'/></td></tr>
<? endforeach; ?>
Now, the id datepicker1 is getting applied perfectly to the required field but the jquery datepicker popup is not coming up as expected.
Whats the solution??
1 Answer