Ran into an interesting bug this morning with jQuery 1.2.2.  After testing a simple working jQuery function in FF, I then tested in IE and found that it didn’t work in IE.  The jQuery code is fairly straightforward, so I was extremely perplexed.

$("#existingFacilities").dblclick(function() { 
	$("#selectedFacilities").append($("#existingFacilities option:selected").clone());
});

All this does is clone an option from one select box and append it to another when it is double-clicked. After a few minutes of debugging, I removed the clone() function and it worked. For some reason, IE won’t work with cloned objects in jQuery. So instead of having a copy of the same option in two select boxes, it’s removed from the first and added to the second.

Here’s my workaround.

$("#existingFacilities").dblclick(function() {
	var selectedOption = $("#existingFacilities option:selected");
	var newOption = new Option($(selectedOption).text(), $(selectedOption).val());
	var ops = $("#selectedFacilities").attr("options");
	
	if( typeof(ops) != "undefined" )
		ops[ops.length] = newOption;
	else
		$("#selectedFacilities").append(selectedOption.clone());
});

Hope this helps someone.