Skip to content

Instantly share code, notes, and snippets.

@rtekie
Created August 26, 2012 20:10
Show Gist options
  • Save rtekie/3483250 to your computer and use it in GitHub Desktop.
Save rtekie/3483250 to your computer and use it in GitHub Desktop.
// When a url is deleted, remove it from the local storage and display the home page.
$("#delurl").live("submit" , function(e, data) {
var url = $("#url_value").val();
delUrl(url);
$.mobile.changePage("#home");
return false;
});
// Delete URL from the list.
function delUrl(url) {
var myUrls = getMyUrls();
var index = findUrl(url);
if (index !== -1) {
myUrls.splice(index, 1);
localStorage.setItem("myUrls", JSON.stringify(myUrls));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment