Difference of "live" in IE vs other browsers
I use the following two functions to create dropdown lists in a table, then once an item is selected from a dropdown, the list disappears and shows the selected item. In most browsers, it works fine, but in IE the dropdown appears but does not disappear when the item is selected (the "change" event doesn't work). I know there is a jquery bug report similar to this, so I suppose my main question is, does anyone have a better idea as to how to achieve this functionality in IE if it truly is a jQuery bug and not me being an idiot, the latter being more likely.
- $(".inv_assign_button").live("click", function () {
var did = $(this).attr("id");
var eid = did.substring(1);
- ------------------creates the select box------------------------
$("#invtd" + eid).html("<select class='ss_box' name='s_select" + eid + "'><?php echo $s_select; ?></select>");
});
- ------------------the following function is bound to each 'ss_box' (created above) via "live"
$(".ss_box").live("change", function(){
var sselected = $(this).val();
var sname = myStudents[sselected];
if (!sname) {
sname = '';
}
var fid = $(this).attr("name");
var gid = fid.substring(8);
- -------------------------this part just changes some hidden form fields so I can save the data in a DB
if ( $("#hidden_inv" + gid).length != 0) {
$("#hidden_inv" + gid).attr({ value: sselected });
} else {
$("#hidden_student_list").append("<input id='hidden_inv" + gid + "' type='hidden' name='s_inv[" + gid + "]' value='" + sselected + "'>");
}
- ------------------------this removes the select box and puts the name of the selection in the same field
$("#invtd" + gid).html(sname + "<div id='d" + gid + "' class='inv_assign_button'>[<font color='#3377CC'>+</font>]</div>");
});
} );