Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

How do we organise for international logistics?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago