selectedTagNames
我这样设置:
var selectedTagNames = $(".js-tag-name:checked").map(function(){return $(this).val()});
selectedTagNames
=> ["song:age_suitability=11-13", "song:age_suitability=5-7"]
它
出现
成为一个数组。我想用“||”将这些值连接到一个字符串中,但我不能:
var searchTerm = selectedTagNames.join('||')
=> VM7234:2 Uncaught TypeError: undefined is not a function
message: "undefined is not a function"
stack: (...)get stack: function () { [native code] }
set stack: function () { [native code] }__proto__: Error
["song:age_suitability=11-13", "song:age_suitability=5-7"].join('||')
=> "song:age_suitability=11-13||song:age_suitability=5-7"
typeof()
.
我使用的是jquery版本1.7.1。
谁能告诉我
b) 如何将所选复选框的值收集到一个数组中,这样我就可以看到有多少个复选框,并将它们连接在一起,避免出现任何问题?