2012-12-03 27 views
0

我有.change jQuery函数。除了一个文本字段外,所有的都在工作。该文本字段将从包含日历的小弹出窗口接收输入。它实际上是一个日期选择器。但是,当我点击任何特定的日历时,似乎该功能没有检测到更改。但如果我手动将日期,它正在工作。我尝试阅读jQuery文档,但找不到答案。是因为仅当我们使用我们的键盘输入输入时才会触发.change函数?。使用javascript datepicker时没有触发交换功能

在此先感谢你们。

我的jQuery代码

$(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'); 
     }); 
    }); 

我的html代码:

<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> 

,大家好,我的问题解决了!我决定更改为jquery日历,它的工作非常好。只是我在找什么。但请记住,确保jquery.js不存在冲突。我有这个问题,我的日历没有显示出来。干杯。

+0

安置自己的HTML和代码。 –

+0

你使用jQuery UI吗? –

+0

请发布html代码,我们可以帮助您更好! – gfivehost

回答

0

尝试使用onSelect事件由jQueryUI的的日期选择器发射。

$("#myPicker").datepicker({ 
    onSelect: function(dateText) { 
    alert(dateText); 
    } 
}); 

http://api.jqueryui.com/datepicker/#option-onSelect

+0

谢谢,我需要使用jQuery日历吗?因为目前我正在使用javascript日历.... – Bizarre