Test ISNaN Amity Calculator JQ 1.12.4

Same Jquery version as WP

by Donna Torr

HTML

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<body marginwidth="0" marginheight="0" data-new-gr-c-s-check-loaded="14.1121.0" data-gr-ext-installed="">
	<!-- href="javascript:w=window.open(window.location.href);w.print();" -->
		<div style="margin-top: 0px;"><a class="print-icon" onclick="if (!window.__cfRLUnblockHandlers) return false; window.print();" title="Print Calculator"><img src="/images/print_calc_icon.png" onmouseover="/images/print_calc_icon_hover.png" onmouseout="/images/print_calc_icon.png"></a></div>

		<div id="chinook-calculator">
		
<div class="custom">
	<div class="calculator-header-top-red">DISCOUNT CALCULATOR</div>
<div class="calculator-header-bottom-grey">
<div class="calculator-form"><span class="discount-label">Enter Your Discount</span> <input id="discount_txt" type="text"> <span class="discount-label">%</span> <a id="discount_btn" class="more_link_red" href="#">Calculate</a> <span class="red_label" style="display: none;">Net Prices in Red</span></div>
</div></div>
 
		</div>	
<div class="item-page">

	<h1 class="title">
		Calcium Silicate 45 Degree Elbow - List Prices
	</h1>
  
<!--Insert table code below -->
         <table class="dcf-table dcf-table-responsive dcf-table-bordered dcf-table-striped dcf-w-100%">
	<thead>
		<tr>
			<td></td>
			<th scope="col"></th>
			<th scope="col">1&quot;</th>
			<th scope="col">1-1/2&quot;</th>
			<th scope="col">2&quot;</th>
			<th scope="col">2-1/2&quot;</th>
			<th scope="col">3&quot;</th>
			<th scope="col">3-1/2&quot;</th>
			<th scope="col">4&quot;</th>
			<th scope="col">Bevels</th>
			<th scope="col"></th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<th scope="row">mm</th>
			<td>Inches</td>
			<td data-label="1"">1&quot;</td>
			<td data-label="1-1/2"">1-1/2&quot;</td>
			<td data-label="2"">2&quot;</td>
			<td data-label="2-1/2"">2-1/2&quot;</td>
			<td data-label="3"">3&quot;</td>
			<td data-label="3-1/2"">3-1/2&quot;</td>
			<td data-label="4"">4&quot;</td>
			<td...

CSS

h2{float:none; clear:both;}
		#sb-body-inner{ width:100%!important; height:300px!important; -webkit-overflow-scrolling:touch!important; overflow-y:scroll!important }
        #sb-body-inner iframe { width:100%; height:100% }
        .sb-wrapper-inner{height:300px!important}
        
#sb-body-inner {
  position: fixed; 
  right: 0; 
  bottom: 0; 
  left: 0;
  top: 0;
  -webkit-overflow-scrolling: touch;
  overflow-y: scroll;
}

#sb-body-inner iframe {
  height: 100%;
  width: 100%;
}
body {color: #4D4D4D;background: #FFF;font-family: Arial, Helvetica, Verdana, Sans-serif;overflow:auto; text-align:center;}
.trPriceFields {height:40px !important;}
.trNewPriceFields{height:17px;}
table.center{margin-left:auto; margin-right:auto; text-align:right}

#DiscountCalculatorTable>td{margin:0px; padding:0px;}
#DiscountCalculatorTable p{text-align:left; margin:0px; padding:0px;}
#DiscountCalculatorTable .pricefield, #DiscountCalculatorTable .bandnumber,  #DiscountCalculatorTable .noprice {text-align:center;font-size:16px;padding-top:0px;padding-bottom:0px;min-width: 40px !important;}

#DiscountCalculatorTable .centered{text-align:center;}

td.noprice {text-align:center;font-size:14px;padding-top:0px;padding-bottom:0px}

#DiscountCalculatorTable .newpricefield {color:#ED4D33;text-align:center;font-size:16px;padding-top:0px;padding-bottom:0px}
#DiscountCalculatorTable .headerTopBorder{border-top:#4D4D4D solid 2px;}
#DiscountCalculatorTable .thinHeaderBottomBorder{border-bottom:#d6d6d6 solid 2px;}
#DiscountCalculatorTable .thinHeaderRightBorder{border-right:#d6d6d6 solid 2px;}
#DiscountCalculatorTable .bigColLeftBorder{border-left:#4D4D4D solid 2px;}
#DiscountCalculatorTable .headerBottomBorder{border-bottom:#4D4D4D solid 2px;}
#DiscountCalculatorTable .thinBottomBorder{border-bottom:#d6d6d6 solid 1px;padding-bottom:0;padding-top:0;}
#DiscountCalculatorTable .thinTopBorder{border-top:#d6d6d6 solid 1px;}
#DiscountCalculatorTable...

JavaScript

$(document).ready(function(){

		//show the tr w/discount prices

		$('.trNewPriceFields').hide();

		$('.red_label').hide();

			//Calculate and show the discounts

			$("#discount_btn").click(function calculate() {

					//alert('DO THE MATH');

					var _price = 0;
					var _newPrice = 0;
					var newpricefieldItems;
					_discount = $('#discount_txt').val();
					
					$('.pipe_cover').attr('rowspan', 50);
					$('.pipe_cover1').attr('rowspan', 20);
					$('.pipe_cover2').attr('rowspan', 20);
					
					$('.pricefield').each(function(i){
						_newPrice = 0;
						_price = $(this).text();

						//apply the discount
						_newPrice = parseFloat(_price) - parseFloat(_price) * _discount/100;
						
						//set the new price in the cell behind w/class newpricefield
						newpricefieldItems = $(".newpricefield");
						newpricefieldItems.eq(i).text(_newPrice.toFixed(2));

					});

					//show the tr w/discount prices and the red label "Net Prices in Red" from the Calculator-Header module
					$('.trNewPriceFields').show();
					$('.red_label').show();

				});

				// calculate if key 'Enter' is hit

				$('#discount_txt').keypress(function (event) {
					if (event.which == 13) {
					//alert('DO THE MATH');

					var _price = 0;
					var _newPrice = 0;
					var newpricefieldItems;
					_discount = $('#discount_txt').val();
					$('.pipe_cover').attr('rowspan', 50);
					$('.pipe_cover1').attr('rowspan', 20);
					$('.pipe_cover2').attr('rowspan', 20);
					$('.pricefield').each(function(i){
						_newPrice = 0;
						_price = $(this).text();

						//apply the discount

						_newPrice = parseFloat(_price) - parseFloat(_price) * _discount/100;

						//set the new price in the cell behind w/class newpricefield
						newpricefieldItems = $(".newpricefield");
						newpricefieldItems.eq(i).text(_newPrice.toFixed(2));

					});

					//show the tr w/discount prices and the red label "Net Prices in Red" from the Calculator-Header...