Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript fixed issue

LeoTheLibra

New Coder
Hi there I've been struggling with this piece of code for a while now and would appreciate any help!!

here is the part im stuck with:
[CODE lang="javascript" title="saveEntry"] // Create an event listener to save the entry when it changes
// (i.e. when the user types into the textarea)
function saveEntry(event) {
// TODO: Q1(c)(iii) Task 1 of 2
// Save the text entry:
// ...get the textarea element's current value
// (getting HTML input values is in Block 2 Part 2 Section 6)
text = textareaElement.value;
// ...make a text item using the value
// (demonstrated elsewhere in this file)
var data = text;
var item = makeItem("text", data);
// ...store the item in local storage using the given key
localStorage.setItem(key, item);
console.log("saved item", key, "=", textareaElement.value);
// (local storage is in Block 3 Part 5)

}

// TODO: Q1(c)(iii) Task 2 of 2
// Connect the saveEntry event listener to the textarea element 'change' event
// (demonstrated elsewhere in this file)
var textareaElement = document.querySelector("textarea");
textareaElement.addEventListener("onblur", saveEntry);
[/CODE]
 
Last edited:
Hi there,

I have restored your posts. Please not erase any thread content if solved, this could potentially help onlookers if they encounter a similar problem.

With that said, if could share the solution and how you solved it that would be great!
 

Buy us a coffee!

Back
Top Bottom