Skip to content

Instantly share code, notes, and snippets.

@shanechin1
Last active March 1, 2017 02:05
Show Gist options
  • Save shanechin1/4486535 to your computer and use it in GitHub Desktop.
Save shanechin1/4486535 to your computer and use it in GitHub Desktop.
My first attempt at a bookmarklet. A simple one which inserts the current date on a page.
javascript: (function(){
alert("Hello?!");
var today = new Date();
var day = today.getDate();
var month = today.getMonth() + 1;
/* January starts with zero */
var year = today.getFullYear();
var thisDate = month + '/' + day + '/' + year;
alert(thisDate);
document.write(thisDate);
}());
/* I previously used the other comment style, which broke the bookmarklet */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment