.....
.....
Hi Team,
i already got this.
for adding to the localstorage JSON:
code
var notes = Apperyio("txtNotes").val();
var title = Apperyio("txttitle").val()
var result = JSON.parse(localStorage.getItem("NotesStorage"));
if(result == null)
result = [];
result.push({Title: title,Notes: notes});
localStorage.setItem("NotesStorage", JSON.stringify(result));
/code
for updating the value inside the JSON object:
code
var vNotes = localStorage.getItem('NotesStorage');
var inputtitle = Apperyio("txttitle").val();
var json = JSON.parse(vNotes);
for (var i = 0; i < json.length; i++) {
if(inputtitle === json.Title){ //look for match with name
json.Notes = Apperyio("txtNotes").val(); //add two
break; //exit loop since you found the person
}
}
localStorage.setItem("NotesStorage", JSON.stringify(json)); //put the object back
/code
delete the specific JSON object:
code
var storedNotes = JSON.parse(localStorage.getItem("NotesStorage"));
var vTitle = Appery("txttitle").val();
// storedAddresses is now an array of objects, not just a string
for ( var i = 0; i < storedNotes.length; i++ ) {
if ( storedNotes.Title === vTitle ) {
// remove the object with storeNumber '714389' from the array
storedNotes.splice(i,1);
}
}
Appery("txttitle").val("");
Appery("txtNotes").val("");
localStorage.setItem("NotesStorage", JSON.stringify(storedNotes)); //put the object back
/code
Could you check entryText's and entryTitle's values?