JQuery: Turn array input values into a string optimization

前端 未结 3 499
迷失自我
迷失自我 2020-12-18 12:20

using jQuery I have the following code:

var selectedIdsArray = $(\"#selectId option:selected\").map(function(){return this.value;});
var selectedIdsStr = $.m         


        
3条回答
  •  清酒与你
    2020-12-18 13:03

    You can also change the second line to this:

    var selectedIdsStr = selectedIdsArray.get().toString()
    

提交回复
热议问题