Skip to content

Instantly share code, notes, and snippets.

@kissarat
Last active December 14, 2015 12:19
Show Gist options
  • Save kissarat/5085816 to your computer and use it in GitHub Desktop.
Save kissarat/5085816 to your computer and use it in GitHub Desktop.
prices = document.getElementsByClassName('preis');
for(i in prices) {
var price = prices[i];
price.innerText = 'ab ' + Math.round(
parseInt(
price.innerText.substring(3)
)*0.8) + ',-€';
}
prices = document.getElementsByClassName('preis');
var reg = /(\d+)/;
for(i in prices) {
var price = prices[i];
if(reg.test(price.innerText))
price.innerText = price.innerText.replace(reg,
Math.round(
parseInt(
reg.exec(
price.innerText)[0])*0.8));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment