I have .change jQuery function. All are working except for one text field. That text field will receive an input from a small pop up window which contains calendar. It is actually a datepicker. But when I click any particular calendar, it seems like the function does not detect the changes. But if I put manually the date, it is working. I try to read the jQuery documentation but cannot find the answer. Is it because of the .change function only triggered when we put the input using our keyboard only?
Thanks in advance guys.
my jquery codes
$(document).ready(function(){
$(".edit_tr").click(function(){
var ID=$(this).attr('id');
$("#first_"+ID).hide();
$("#first_input_"+ID).show();
var first=$("#first_input_"+ID).val();
alert('content: '+first);
}).change(function(){
alert('change');
});
});
my html codes:
<tr id = "<?php echo $id; ?>_6" bgcolor='#f2f2f2' class='edit_tr'>
<td><span class="pro_text-form"><font color="red">*</font> Date of Birth </span></td>
<td class="edit_td">
<span id="first_<?php echo $id; ?>_6" class="text"><?php echo $dob; ?></span>
<input type="hidden" value="<?php echo $dob; ?>" class="editbox" id="hidden_first_input_<?php echo $id; ?>_6" />
<input type="text" class="editbox" name="open_date" id="first_input_<?php echo $id; ?>_6" value="<?=$dob?>" size="10" />
<a href="javascript:NewCal('first_input_<?php echo $id; ?>_6','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a>
</td>
</tr>
Guys, my problem solved! I have decided to change to jquery calendar, and it works really nice. just what i am looking for. but bare in mind, ensure that there is no conflict for the jquery.js. i got that problem and my calendar is not showing up. cheers.
Yes, change is triggered on blur when the value changed. jQuery’s datepicker has a similar change event you can bind to.
http://api.jqueryui.com/datepicker/#option-onSelect