开发者

Change event for combobox not getting fired in jQuery

I am working in PHP. I have written code for displaying a combo box like this:

<select name="country" id="idCountry" class="clsCountry" >
    <?php foreach($objCountries as $objCountry):?>
        <option value="<?php echo $objCountry->getId()?>" ><?php echo $objCountry->getName()?>   </option>
    <?php endforeach;?>
</sele开发者_运维知识库ct></td>

For change event:

$("#idCountry").change(function(){ .... });

but change event is not getting fired. How can I fix this problem?


First, is the code placed inside the ready function of the document?

$(document).ready(function()
{
     //code here
});

Or try this:

$("#idCountry").ready(function()
{
  $("#idCountry").change(function(){
    //code here
  });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜