我有var string = (2200 x 1500)(2441 x 1610)
我想将括号内的字符串拆分为数组,因此 href[0] = (2200 x 1500)
和 href[1] = (2441 x 1610)
我已经尝试过这个:
var href = [];
$(document).each(function () {
var hey = matchingDivs.text();
var res = hey.split(")(");
href.push(res);
});
这样当我像这样发出警报时 alert("("+href[href.length -1]);
结果应该是 (2441 x 1610)
但是相反,它提出了 see JSFIDDLE
最佳答案
关于jquery - 在括号内分割字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21091540/