我試圖在日後檢索數組中放入一些html標記。我的編輯器在description1行上拋出語法錯誤,我找不到原因。任何幫助將非常感激。下面的代碼。謝謝對象字面量語法錯誤中的JavaScript字符串字面值錯誤
var modalcontent = {
description1 : '<div id = "description"><div class = "tbc">
<label class = "tbc" for = "tbc">Description</label>
</div>
<div class = "tbc">
<input type = "text" class = "tbc" name = "description" id = "tbc" placeholder = "Enter description">
</div>
</div>
<!--end description div-->'
}
將你的HTML存儲在stings中是不好的做法。稍後當您想更改或添加內容時,您會注意到它。 –