internet explorer - jquery .change not firing in IE but working in FFOX -


i have following html:

<form method="post" action="#" name="dialog_head" id="dialog_head" class="jqtransform">        <ul>         <li class="pdf">             <a title="this pdf document opens in new window" target="_blank" href="#">save pdf</a>         </li>         <li class="print">             <a target="_blank" href="#">print price report</a>         </li>          <li>             <label for="dialog_select">select price report:</label>             <select name="dialog_select" id="dialog_select"><option value="pricereport/13415939">23 april 2010</option> <option value="pricereport/13415510">16 april 2010</option> <option value="pricereport/13415009">09 april 2010</option> <option value="pricereport/13414608">02 april 2010</option> </select>         </li>        </ul> </form> 

with following jqquery event listener attached select:

   $('select#dialog_select').live('change', function() {         alert("foo");          //set select value         var $optionval = $(this).val();          if ($optionval != '') {              // remove testing class when new report has been requested             $('#cboxloadedcontent > div').addclass('dialog_loading').removeclass('dialog_loaded');              // call price report , replace current price report             $.ajax({                 type: 'get',                 url: $optionval,                 datatype: 'html',                 cache: true,                 success: function(data) {                      var $finddata = $(data).find('.section1');                      $('.section1').fadeout('fast', function() {                          $('.section1').replacewith($finddata).fadein('fast');                          $('.section1, .section1 table').css({                             'width': '95%',                             'margin': 'auto'                         });                          // testing class when report has been loaded                         $('#cboxloadedcontent > div').removeclass('dialog_loading').addclass('dialog_loaded');                      });                 },                  error: function(xhr, ajaxoptions, thrownerror) {                     // testing class load error                     $('#cboxloadedcontent > div').removeclass('dialog_loading dialog_loaded').addclass('dialog_load_failure');                     alert(xhr.status);                     alert(thrownerror);                 }              });         }      }); 

this works in ffox not in ie7 , don't know why???

  $('#dialog_select').change(function() { ... }); 

should trick.

there's no point in prepending id "select" way. thing slow down jquery making isolate select tags. id fastest.

edit - sadat mentioned, code should wrapped in @ least a

$(document).ready(function(){ ... });  

if isn't already.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -