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>
<开发者_如何学Python/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)
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/
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>
You can use the IE Developer Toolbar: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535
精彩评论