save a note to localstorage as an Object
This commit is contained in:
parent
029d2276fa
commit
1e6a4b2fdf
@ -26,12 +26,12 @@ body{
|
|||||||
border:1px black solid;
|
border:1px black solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#memo{
|
#noteText{
|
||||||
width: 300px;
|
width: 300px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
#input1{
|
#inputTitle{
|
||||||
margin-bottom:5px;
|
margin-bottom:5px;
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,16 @@
|
|||||||
</h6>
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
<div id=addNoteDiv>
|
<div id=addNoteDiv>
|
||||||
<button type="button" id=addNote>+</button>
|
<button type="button" id=addNoteButton>+</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id=noteFormDiv>
|
<div id=noteFormDiv>
|
||||||
<form id=noteForm>
|
<form id=noteForm>
|
||||||
<input type="text" name="noteTitle" id="input1" placeholder="Enter title...">
|
<input type="text" name="noteTitle" id="inputTitle" placeholder="Enter title...">
|
||||||
<div>
|
<div>
|
||||||
<textarea name=noteText id=memo placeholder="Enter notes..."></textarea>
|
<textarea name=noteText id=noteText placeholder="Enter notes..."></textarea>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" id=saveNote>Save</button>
|
<button type="button" id=saveNoteButton>Save</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -2,4 +2,38 @@ $(document).ready(function(){
|
|||||||
$("#addNoteDiv").on('click', function() {
|
$("#addNoteDiv").on('click', function() {
|
||||||
$("#noteFormDiv").toggle()
|
$("#noteFormDiv").toggle()
|
||||||
})
|
})
|
||||||
|
$("#saveNoteButton").click(getNoteObject);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const noteFolder = "C:\\Users\\wuest\\Desktop\\Studium\\Master\\MDT5\\Hofmann\\Praktikum\\WebApp\\notes\\";
|
||||||
|
|
||||||
|
function saveNoteObject(){
|
||||||
|
let noteTitle = document.getElementById('inputTitle').value;
|
||||||
|
let noteText = document.getElementById('noteText').value;
|
||||||
|
|
||||||
|
let noteObj = {
|
||||||
|
title: noteTitle,
|
||||||
|
text: noteText
|
||||||
|
};
|
||||||
|
|
||||||
|
let noteObj_serialized = JSON.stringify(noteObj);
|
||||||
|
localStorage.setItem("noteObj", noteObj_serialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNoteObject(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user