我想將 variable 的值連接i到 string item。我嘗試如下,但它不作業。我怎樣才能做到這一點?
var tableString = "<td><input type='text' id='item' i><td>"
我已經瀏覽了這個鏈接:在 JavaScript 中為變數字串加上引號。我能得到一些幫助嗎?
uj5u.com熱心網友回復:
如果要在字串中使用變數,則必須像這樣使用模板文字。
var tableString = `<td><input type='text' id='item${i}'><td>`
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/469077.html
標籤:javascript html jQuery 细绳
上一篇:用JS過濾HTML串列
