Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is the current piece of CSS code I am working with. Please ammend this code in CSS for the answer: /** * Add a

image text in transcribed

Below is the current piece of CSS code I am working with. Please ammend this code in CSS for the answer:

/** * Add a text entry to the page * @param key Key of item in local storage * @param initialText Initial text of diary entry * @param isNewEntry true if this is a new entry to start typing into */ 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() { // A new version of this function is created every time addTextEntry is called, // so it can access all the variables available in this call to addTextEntry console.log("saveEntry called with variables in scope:", { key, text, isNewEntry, textareaElement, });

// TODO: Q1(c)(iii) Task 1 of 2 // Save the text entry: // ...get the textarea element's current value // ...make a text item using the value // (demonstrated elsewhere in this file) // ...store the item in local storage using the given key // Tip: this is easier to test if you complete Task 2 before Task 1 }

// TODO: Q1(c)(iii) Task 2 of 2 // Connect the saveEntry event listener to the textarea element 'change' event // (demonstrated elsewhere in this file) // Tip: this is easier to test if you complete Task 2 before Task 1 }

Edit the script where indicated in 'tma03.js' to store each text entry in local storage when it is edited. (8 marks) The demonstration application allows users to add text entries to the page, but they are not saved. The prototype application should save diary entries as they are typed, so that they reappear when the application is restarted. Add JavaScript code where indicated to achieve the following: - Task 1: make a text item representing the current value of the text area and - store this item in local storage. - Task 2: execute the event listener you completed in Task 1 when the text input changes

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions