JQuery Division

Developer
Size
1,970 Kb
Views
38,456

How do I make an jquery division?

Calculate 50% off a price and if price is odd, trim third decimal without rounding.. What is a jquery division? How do you make a jquery division? This script and codes were developed by Jeff Pannone on 12 August 2022, Friday.

JQuery Division Previews

JQuery Division - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>jQuery Division</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="prod_price"><span id="price">$4.49</span></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

JQuery Division - Script Codes CSS Codes

body{font-family:helvetica, sans-serif}
#prod_price span{display:block;}
.discountPrice{ font-weight:bold; margin-top:1em; width:auto;
}

JQuery Division - Script Codes JS Codes

//for 50% off
//var priceMath = $('#price').html().replace('$', '') / 2;
//for 70% off
var priceMath = $('#price').html().replace('$', '') / 3.33333;
//for 70% off
var discountPrice = priceMath.toFixed(2);
//for 50% off
//var discountPrice = Math.floor(priceMath * 100) / 100;
console.log(priceMath);
console.log(discountPrice);
var htmlOut = '';
htmlOut += '<span class="discountPrice">$' + discountPrice
+ ' with Promo Code: XYZ2345YES</span>'
// output new discount message
$('#prod_price').append(htmlOut);
$('#price').css('text-decoration','line-through');
JQuery Division - Script Codes
JQuery Division - Script Codes
Home Page Home
Developer Jeff Pannone
Username jeffpannone
Uploaded August 12, 2022
Rating 3
Size 1,970 Kb
Views 38,456
Do you need developer help for JQuery Division?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Jeff Pannone (jeffpannone) Script Codes
Create amazing marketing copy with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!