Skip to content

Instantly share code, notes, and snippets.

View JadeDickinson's full-sized avatar

Jade Dickinson JadeDickinson

View GitHub Profile
alert("hello this is a less spooky message");
@JadeDickinson
JadeDickinson / gist:f0bb6f623240e4d4df02c75c548138f2
Created January 30, 2021 17:21
Tesco - sort items by price per kg
var array = []
// Get all product list items including parent nodes (document.getElementsByClassName(product-list--list-item) only gets the parent list items, not the children including price by weight)
var pricePerWeightElements = document.getElementsByClassName('price-per-quantity-weight')
for(var i=0; i<pricePerWeightElements.length; i++){
array.push(pricePerWeightElements[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode);
}
for (var i=0; i<array.length; i++) {