Skip to content

Instantly share code, notes, and snippets.

@kern-me
Created October 17, 2018 13:14
Show Gist options
  • Save kern-me/c179e6fe31343a79723d0ec16a4e4b95 to your computer and use it in GitHub Desktop.
Save kern-me/c179e6fe31343a79723d0ec16a4e4b95 to your computer and use it in GitHub Desktop.
Javascript : Populate Etsy tags to the Title Input
function makeArray() {
var arr = [];
arr[0] = document.querySelectorAll(".tag.tag-left")[0].innerText.trim();
arr[1] = document.querySelectorAll(".tag.tag-left")[1].innerText.trim();
arr[2] = document.querySelectorAll(".tag.tag-left")[2].innerText.trim();
arr[3] = document.querySelectorAll(".tag.tag-left")[3].innerText.trim();
arr[4] = document.querySelectorAll(".tag.tag-left")[4].innerText.trim();
arr[5] = document.querySelectorAll(".tag.tag-left")[5].innerText.trim();
arr[6] = document.querySelectorAll(".tag.tag-left")[6].innerText.trim();
arr[7] = document.querySelectorAll(".tag.tag-left")[7].innerText.trim();
arr[8] = document.querySelectorAll(".tag.tag-left")[8].innerText.trim();
arr[9] = document.querySelectorAll(".tag.tag-left")[9].innerText.trim();
arr[10] = document.querySelectorAll(".tag.tag-left")[10].innerText.trim();
arr[11] = document.querySelectorAll(".tag.tag-left")[11].innerText.trim();
arr[12] = document.querySelectorAll(".tag.tag-left")[12].innerText.trim();
return arr.toString().replace(/,/g, ' ')
}
document.getElementById('title').value = makeArray();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment