我有一個(gè)變量,它是重復(fù)列表的一部分,當(dāng)我使用 console.log 時(shí),可以看到帶引號的字符串,但當(dāng)打印時(shí),會截掉除該列表之外的所有內(nèi)容。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" 監(jiān)視器,并顯示為 console.log 語句中的內(nèi)容。但是,當(dāng)它達(dá)到 value="'+tempDesc'" 時(shí),它僅顯示單詞 48。我嘗試在引號前添加斜杠,但是毫無喜悅。
顯示帶引號的 Javascript 變量
慕萊塢森
2023-10-14 16:15:50