1

i have some jquery code here that works fine in firefox but when i test in ie6, i dont see it working at all (the div is not being shown).

here is my html

 <b>Calendar:</b> <select name="CalendarId" id="calendar_list">
 <option value="1">Vacation</option><option value="2">Internal Travel</option>
 <option value="13">ER</option><option value="33">PMO Calendar</option>
 </select>

 <span style="display: none;" id="calendarlabel"></span>

    <hr>

    <div id="location" style="display: none;">
    <label>Travelling to:</label> <select id="location_list" name="TechnicalCentreId">    
 <option></option>
 <option value="1">Bangalore</option>
 <option value="2">Chennai</option>
 </select>
    </div>

here is my javascript:

 $('#calendar_list').live('change', function () {
    var calendarId = $(this).val();
    if (calendarId == 2) {
        $("#location").show();
    }
    else {
        $("#location").hide();
    }
});

First, does anyone know why this code above would not work in ie6 but be fine in all other browswers?

Second, how can i debug this as it seems to only be an issue in ie6 (need firebug equivalent to see whats happening)

leora
  • 188,729
  • 360
  • 878
  • 1,366

3 Answers3

2

IE does not bubble the 'change' event properly, so you can't use live('change').

Instead, bind your behavior to the change event at load time:

$(document).ready(function(){

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

http://api.jquery.com/live/

hybernaut
  • 606
  • 4
  • 7
  • need live because i am refreshing using ajax. i wound up using livequery plugin which seems to do the trick – leora Nov 04 '10 at 04:41
  • I have had similar problems with live('change') on dyn content. live() works for many other events, but for 'change' you can rebind the behavior in the success handler of the ajax call. – hybernaut Nov 04 '10 at 05:09
0

You can use Firebug Lite. It allows you to use a lite version of Firebug where you can't use the full extension.

http://getfirebug.com/firebuglite

All you need to do to use Firebug Lite is add the following external script:

<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
Rebecca Chernoff
  • 22,065
  • 5
  • 42
  • 46
0

You can use the IE Developer Toolbar: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535

Will Peavy
  • 2,349
  • 3
  • 21
  • 21