我有一個變量,它是重復列表的一部分,當我使用 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 變量
慕萊塢森
2023-10-14 16:15:50