View Full Version : HTML Storage Script Not working.

05-25-2012, 08:24 PM
<h2>Demo of Local Storage: My to do list </h2>
<li id="edit" contenteditable="true"> </li >

// This part should store what's written.
{ localStorage.edit=getElementById("edit");
localStorage.setItem( 'toDoData' , this.innerHTML));
document.getElementById("edit").innerHTML=("Test of : " + localStorage.Edit);
) }

05-25-2012, 09:51 PM
</u> S/B </ul>

$edit.blur Probable S/B $(edit).blur

If your 'if' is correct you need () after it and if the
document.getElementById("edit").innerHTML=("Test of : " + localStorage.Edit)

and if that is what you want in there it's not coded right

But if is a separate line it S/B

document.getElementById("edit").innerHTML="Test of : " + Something;

05-25-2012, 10:04 PM
so how does it go exactly, where do i put this?

im confused, since i didnt make this script

05-25-2012, 11:07 PM
Lots of errors:

if(typeof(Storage)!=="undefined")should be
- - - - -
localStorage.edit=getElementById("edit"); you cannot use getElementById() alone.
it must be
element.getElementById("edit"); where element. most likely should be document.
and you are probably trying to use the innerHTML of #edit
localStorage.edit=document.getElementById("edit").innerHTML;- - - - -
$edit.blur(function(is wrong,unless you have assigned an element to $edit, e.g:

$edit=document.getElementById("edit")I guess you are trying to use jQuery's equvalent of document.getElementById(), then it must be
$('#edit').blur() and you are also trying to set the function as a parameter of the blur function

- - - - -
you save the data as localStorage.edit but tries to read it as localStorage.Edit
Javascript is case-sensitive, which means that they are not equal.
- - - - -
and you are storing the item toDoData by
localStorage.setItem( 'toDoData' , this.innerHTML)); but you do not use this data afterwards.
- - - - -
I guess that you are looking for this:
{ localStorage.edit=document.getElementById("edit").innerHTML;
document.getElementById("edit").innerHTML=("Test of : " + localStorage.edit);

05-25-2012, 11:20 PM
thanks alot for the help guys