我收到的控制檯錯誤這條線:jQuery的無效左側錯誤
$("#note" + noteCount).val() = note;
以下是完整的功能:
function addNotes() {
noteCount++;
var note = $("#noteInput").val();
console.log("Note: " + note);
console.log("Note Count: " + noteCount);
var display = document.createElement("div");
document.getElementById("displayContainer").appendChild(display);
display.className = "noteDisplay";
display.id = "note" + noteCount;
$("#note" + noteCount).val() = note;
}
正如你可以看到我創建一個div與ID'筆記'+筆記計數,但我不知道如何選擇它來改變它的值。
的可能的複製[的ReferenceError:在分配無效的左側(http://stackoverflow.com/questions/18597667/referenceerror-invalid-left-hand -side-in-assignment) –