JSFiddle - React, Tailwind, and code Playground

by hslincoln

HTML

<!-- to see in a live environment, use this link -->
http://www.jmldirect.com/uk/at-home/home-environment/icat/12homeenv

JavaScript

<script type="text/javascript">
jQuery(document).ready(function percentOffTags() {

        jQuery("#productList ul.gridStyle li").each(function () {
            var wasPriceMinusWasRemoval = jQuery('p.was', this).text().replace(/\u00A3/g, '');
            var wasPrice = wasPriceMinusWasRemoval.replace("Was ", "");
            var actualPriceBeforeFrom = jQuery('.price', this).text().replace(/\u00A3/, '');
            var actualprice = actualPriceBeforeFrom.replace("From ", "");
 

            if (+actualprice <= +wasPrice) {
                var divforpercentage = +actualprice / +wasPrice * 100;
                var finalpercentage = 100 - +divforpercentage;

				if ((+finalpercentage > 7.00) && (+finalpercentage < 12.50)) { // 10%
                    jQuery('#red-tag-area', this).show();
                    jQuery('#red-tag', this).attr('src', "http://www.jmldirect.com/content/ebiz/shop/resources/exp/redtags/rt_10_percent_off.png");
                    return true;
                }                

				if ((+finalpercentage > 12.51) && (+finalpercentage < 17.50)) { // 15%
                    jQuery('#red-tag-area', this).show();
                    jQuery('#red-tag', this).attr('src', "http://www.jmldirect.com/content/ebiz/shop/resources/exp/redtags/rt_15_percent_off.png");
                    return true;
                }

				if ((+finalpercentage > 17.51) && (+finalpercentage < 22.50)) { // 20%
                    jQuery('#red-tag-area',this).show();
                    jQuery('#red-tag', this).attr('src', "http://www.jmldirect.com/content/ebiz/shop/resources/exp/redtags/rt_20_percent_off.png");
                    return true;
                }

                if ((+finalpercentage > 22.51) && (+finalpercentage < 27.50)) { // 25%
                    jQuery('#red-tag-area',this).show();
                    jQuery('#red-tag', this).attr('src', "http://www.jmldirect.com/content/ebiz/shop/resources/exp/redtags/rt_25_percent_off.png");
                   ...