}
function delete() {
alert("deneme");
}
function fetchBookmarks() {
var bookmarks=JSON.parse(localStorage.getItem("Bookmarks"));
var result=document.getElementById("results");
bookmarks.forEach(function (e) {
result.innerHTML+='';
})
Bu kısım sorunsuz çalışıyor
<script>
</script>
document.getElementById('frm').addEventListener('submit',saveBookmark);
function saveBookmark(event) {
var site=document.querySelector('#site').value;
var url=document.querySelector('#url').value;
var values={
name:site,
url:url
}
if(localStorage.getItem("Bookmarks")===null){
var obj=[];
obj.push(values);
localStorage.setItem("Bookmarks",JSON.stringify(obj));
}
else{
var existingBookMarks=JSON.parse(localStorage.getItem("Bookmarks"));
existingBookMarks.push(values);
localStorage.setItem("Bookmarks",JSON.stringify(existingBookMarks));
}
event.preventDefault();
}
function fetchBookmarks() {
var bookmarks=JSON.parse(localStorage.getItem("Bookmarks"));
var result=document.getElementById("results");
bookmarks.forEach(function (e) {
result.innerHTML+='';
})
}