Progress bar for counting checkboxes

Developer
Size
2,268 Kb
Views
101,200

How do I make an progress bar for counting checkboxes?

Uses a bit of Javascript to count checkboxes with a JQuery UI progress bar. What is a progress bar for counting checkboxes? How do you make a progress bar for counting checkboxes? This script and codes were developed by James Barnett on 11 August 2022, Thursday.

Progress bar for counting checkboxes Previews

Progress bar for counting checkboxes - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Progress bar for counting checkboxes</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Progress bar for counting checkboxes</h1>
<form> <p> <input type="checkbox" name = "box1"/> <input type="checkbox"name = "box2" /> <input type="checkbox" name = "box3"/> </p>
</form>
<div class="progressbar-container"> <div class="progressbar-bar"></div> <div class="progressbar-label"></div>
</div>
<div class = "ready"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Progress bar for counting checkboxes - Script Codes CSS Codes

body { margin: 20px 50px; }
h1 { font-size: 1.5em; }
p { margin: 0; }
input[type="checkbox"] { height: 20px; width: 20px; margin-right: 10px;
}
.ready { font-size: 1.5em; }
.ui-progressbar-value { background: lightgreen; }
.progressbar-container { position: relative; width: 350px;
}
.progressbar-bar { height: 25px;
margin: 10px 0;
border-radius: 7px;
}
.progressbar-label { position: absolute; top: 2px; left: 45%; z-index: 2;
}

Progress bar for counting checkboxes - Script Codes JS Codes

$(document).ready(function() { // get box count var count = 0; var checked = 0; function countBoxes() { count = $("input[type='checkbox']").length; console.log(count); } countBoxes(); $(":checkbox").click(countBoxes); // count checks function countChecked() { checked = $("input:checked").length; var percentage = parseInt(((checked / count) * 100),10); $(".progressbar-bar").progressbar({ value: percentage }); $(".progressbar-label").text(percentage + "%"); } countChecked(); $(":checkbox").click(countChecked);
});
Progress bar for counting checkboxes - Script Codes
Progress bar for counting checkboxes - Script Codes
Home Page Home
Developer James Barnett
Username jamesbarnett
Uploaded August 11, 2022
Rating 3.5
Size 2,268 Kb
Views 101,200
Do you need developer help for Progress bar for counting checkboxes?

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!

James Barnett (jamesbarnett) Script Codes
Create amazing blog posts 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!