【发布时间】:2017-09-01 07:00:00
【问题描述】:
我收到此行的控制台错误:
$("#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;
}
如您所见,我正在创建一个 id 为 'note' + note count 的 div,但我不确定如何选择它来更改其值。
【问题讨论】:
标签: javascript jquery