Boa*_*rdy 0 javascript firefox jquery
我正在开展一个网络项目,我遇到了一个奇怪的问题.
我有一个textarea如下:
<textarea style="margin-bottom: 5px" id="txtSupportDescription" name="txtSupportDescription[]" placeholder="Support Description" rows="10"></textarea>
Run Code Online (Sandbox Code Playgroud)
然后我有以下jquery
var supportComments = [];
$('textarea[name="txtSupportDescription[]"').each(function()
{
supportComments.push($(this).val());
});
Run Code Online (Sandbox Code Playgroud)
它在Chrome和IE中工作正常但在firefox中我收到以下错误:
错误:语法错误,无法识别的表达式:]"但它在jQuery库中抛出错误.
我不明白为什么当Chrome和IE完全没问题时Firefox会出现这个问题.
看起来你在最后错过了一个结束括号"]".应该:
$('textarea[name="txtSupportDescription[]"]')
Run Code Online (Sandbox Code Playgroud)