我想在我的选择上启动触发器,但似乎没有任何效果:
这是我的选择:
<select id="sel_annee">
        <option value="<?php echo (date('Y')-1); ?>"><?php echo (date('Y')-1); ?></option>
        <option value="<?php echo date('Y'); ?>" selected='selected'><?php echo date('Y'); ?></option>
        <option value="<?php echo (date('Y')+1); ?>"><?php echo date('Y')+1; ?></option>
    </select>
这是我的触发器:
$(document).ready(function(){
           $('#sel_annee').trigger("change");
这就是功能
$('#sel_annee').change(function()
           {
              alert("here");            
              $('.month').hide();
              $('.month:first').show();
              $('.months a:first').addClass('active');
                          $.ajax({
                             type: 'post',
                             url: 'changer_annee.php',
                             data:
                             {
                                year:$('#sel_annee').val()
                             },
                             dataType: 'text',
                             success: function(retour_php)
                             {
                                $('#month1').html('');         
                                //console.log(retour_php);
                                var arr = retour_php.split('#');
                                //console.log(retour_php);
                               for(i= 1; i<=12;i++)
                               {
                                  $('#month'+i).html(arr[i-1]);
                                  //console.log($('#month'+i));
                                  //console.log(arr[i]);
                               }
                               //$('.month').hide();
                               $('.month:first').show();
                               $('.months a').removeClass('active');
                               $('.months a:first').addClass('active');
                               //$('.months a:first').addClass('active');
                             },
                             error: function(retour_php)
                             {
                                alert("pas ok");
                                alert(retour_php);
                             }
                          }
                          );
           });
此警报不起作用:
$('#sel_annee').change(function()
               {
                  alert("here");
我想我做了所有我必须做的,但触发器不起作用。
任何的想法 ?提前致谢。