Tickets counter
How do I make an tickets counter?
What is a tickets counter? How do you make a tickets counter? This script and codes were developed by Robic on 11 August 2022, Thursday.
Tickets counter - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Tickets counter</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="count"> <button class="more">More</button> <p>12</p> <button class="less">Less</button> <p><span class="total-ticket">0</span> Tickets</p>
</div>
<div class="count"> <button class="more">More</button> <p>15</p> <button class="less">Less</button> <p><span class="total-ticket">0</span> Tickets</p>
</div>
<div class="count"> <button class="more">More</button> <p>18</p> <button class="less">Less</button> <p><span class="total-ticket">0</span> Tickets</p>
</div>
<p class="total"><span class="total-number">0</span> €</p> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Tickets counter - Script Codes CSS Codes
.count { float: left; margin-right: 20px;
}
Tickets counter - Script Codes JS Codes
total = 0;
var count = $('.count')
$('.count').each(function(totalPush){ totalPush = 0; $(this).children('.more').on('click', function(){ that = $(this).parent('.count').find('p'); parent = $(this).parent('.count'); val = that.html(); total += parseInt(val); $('.total-number').html(total); totalPush++; parent.find('.total-ticket').html(totalPush) }) $(this).children('.less').on('click', function(){ if(totalPush > 0){ that = $(this).parent('.count').find('p'); parent = $(this).parent('.count'); val = that.html(); total -= parseInt(val); $('.total-number').html(total); totalPush--; parent.find('.total-ticket').html(totalPush) } })
})
![Tickets counter - Script Codes](http://shots.codepen.io/AudreyRBC/pen/JWpZZO-512.jpg)
Developer | Robic |
Username | AudreyRBC |
Uploaded | August 11, 2022 |
Rating | 3 |
Size | 2,076 Kb |
Views | 40,480 |
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!
Name | Size |
Multifiltre | 3,450 Kb |
Multi-range Jquery | 3,166 Kb |
Geoloc Realtime | 2,064 Kb |
A Pen by Robic | 2,548 Kb |
Ajax utick | 2,233 Kb |
Select with popup | 5,674 Kb |
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!
Name | Username | Size |
Javascript Welcome | Peterlewicki | 1,573 Kb |
Awesome textarea | Ayoungh | 1,977 Kb |
A Pen by Shidhin | Shidhincr | 5,015 Kb |
Simple Accordion | Wearebold | 3,683 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
A Pen by Huan Nghiem | Nightshade | 10,646 Kb |
Product item | Mymahesh11 | 2,256 Kb |
CSS Parent Selector | Tomhodgins | 2,143 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!