I have a listbox containing "all" the items and a second listbox that will contain "selected" items. I want to have it so that do开发者_Go百科uble-clicking an item in the "all" listbox adds that item to the "included" listbox.
Currently i have :
$(document).ready(function()
{
$('#AllAirlines option').dblclick(AddAirline);
}
function AddAirline()
{
$('#AllAirlines option:selected').remove().appendTo('#AirlineList');
}
Which works fine in FireFox... but in IE8 etc, fails. Any ideas why?
Here is a slightly updated version that also works in IE8 - it just doesn't like the event hook up... and you also forgot to close your document-ready...
$(document).ready(function()
{
$('#AllAirlines').dblclick(function() { AddAirline(); });
});
function AddAirline()
{
$('#AllAirlines option:selected').remove().appendTo('#AirlineList');
}
精彩评论