Question: JS code: function addTextEntry(key, text, isNewEntry) { // Create a textarea element to edit the entry var textareaElement = document.createElement(textarea); textareaElement.rows = 5; textareaElement.placeholder =

JS code: function addTextEntry(key, text, isNewEntry) { // Create a textarea element to edit the entry var textareaElement = document.createElement("textarea"); textareaElement.rows = 5; textareaElement.placeholder = "(new entry)";

// Set the textarea's value to the given text (if any) textareaElement.value = text;

// Add a section to the page containing the textarea addSection(key, textareaElement);

// If this is a new entry (added by the user clicking a button) // move the focus to the textarea to encourage typing if (isNewEntry) { textareaElement.focus(); }

// Create an event listener to save the entry when it changes // (i.e. when the user types into the textarea) function saveEntry() {

This is what I need to do: Task 1 of 2 // Save the text entry: // ...get the textarea element's current value // ...make a text item using the value // ...store the item in local storage using the given key

so far I have this but Its not working please help

textareaElement.addEventListener("input", function(){ function makeTextItem(type,data) { var textObject = {type: type, data: data}; return JSON.stringify(textareaElement.value); function createTextItems() { var item; localStorage.textareaElement(key,item); }}});

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!