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
});
});
精彩评论