【发布时间】:2020-12-04 11:08:16
【问题描述】:
我有一个变量,它是重复列表的一部分,当我使用 console.log 时,可以看到带引号的字符串,但打印时会删除除此之外的所有内容。
function sendToPackList(){
for(let i = 0; i < $('[name="tempQuant[]"]').length; i++){
if($('[name="tempQuant[]"]')[i].value > 0){
packItem++;
let temprow = $('[name="tempQuant[]"]').eq(i).parent().parent().parent().parent();
let tempDesc = temprow.find('[name="tempDesc[]"]')[0].value
console.log(tempDesc);
let tempWeight = temprow.find('[name="tempWeight[]"]')[0].value
let tempQuant = temprow.find('[name="tempQuant[]"]')[0].value
$('#packlistItems').append('<div class="row"><div class="6u"><div style="position:relative">
<input type="text" name="goodsDesc[]" onkeyup="stockAutocomplete(this)" autocomplete="off" value="'+tempDesc+'"></div></div></div>
变量名为 tempDesc 并保存字符串 48" 监视器,并在 console.log 语句中显示。但是当它到达 value="'+tempDesc'" 时,它只显示单词 48。我之前尝试过添加斜杠引用但没有喜悦。
【问题讨论】:
标签: javascript function loops