how to select and deselect all options in a select box

前端 未结 5 729
情歌与酒
情歌与酒 2021-02-14 02:02

    
    
    



JS:

$('#selectall').click(function() {
    $('#studentremain > option').attr("selected", "selected");
});   

$('#deselectall').click(function() {
    $('#studentremain > option').removeAttr("selected");
});

提交回复
热议问题