Lee*_*joy -1 javascript jquery jquery-ui jquery-selectors
当我尝试.html()在JQuery中使用方法插入空间时,我遇到了问题.以下是我的代码:
html += '<td >'+description+". "+location;
html += +" "+position;
html += +" "+side+'</td>';
$('#tempResult').html(html);
Run Code Online (Sandbox Code Playgroud)
我得到的结果如下:
Green Tint. 0FrontNaNRight
+从字符串中删除运算符.+=处理字符串连接,因此附加+符号只是尝试使字符串为正(导致解释器将其更改为NaN- 而不是数字).
a += b是一种"速记方式"(也许是一种简化)的说法a = a + b.
html += '<td >'+description+". "+location;
html += " "+position;
html += " "+side+'</td>';
$('#tempResult').html(html);
Run Code Online (Sandbox Code Playgroud)