I am writing a code that will allow users to write note, I'm using fieldset instead of textarea. I need to access the value in the fieldset and make use of the text. I can't access it unless I add an input elements.
const write = document.querySelector("#write");
const body = document.querySelector("body");
const form = document.querySelector("#form")
const list = document.querySelector("#list");
const button = document.createElement("button");
write.addEventListener("click", function (e){
e.preventDefault()
console.log(e);
const page = document.createElement("form");
const fieldset = document.createElement("fieldset");
page.action = "./nowhere";
fieldset.contentEditable = true;
fieldset.id = "text";
fieldset.name = "text";
// fieldset.append(input)
page.append(fieldset);
write.append(page);
page.append(button);
const myText = write.form.fieldset.value;
console.log(myText);
})