html代码
代码如下:
|
|
//iterate through each option of the listbox
for(var count= src.options.length-1; count >= 0; count--) {
//if the option is selected, delete the option
if(src.options[count].selected == true) {
try {
src.remove(count, null);
} catch(error) {
src.remove(count);
}
}
}
}
当然,如果使用jQuery来删除,那就方便了,一句话就搞定了
代码如下:
$("#sourceId").find('option:selected').remove();