Skip to content

Instantly share code, notes, and snippets.

@igrep
Created August 27, 2020 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igrep/a41d2f9678621b5bb5e5e0d7c79ae6e5 to your computer and use it in GitHub Desktop.
Save igrep/a41d2f9678621b5bb5e5e0d7c79ae6e5 to your computer and use it in GitHub Desktop.
Function to a given item to Google Shopping List. Paste the code in the DevTools' console!
const input = document.getElementsByClassName("listItemInput")[0];
const form = document.getElementsByClassName("addForm")[0];
function addItem(name){
input.dispatchEvent(new Event("focus"));
input.value = name;
input.dispatchEvent(new Event("input"));
form.dispatchEvent(new Event("submit"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment