Get started with grade-js CDN
ISC licensed
Grade.js is a lightweight library for automatically grading student Quizlet-style learning activities.
Tags:- complimentary
- gradients
- image
- color
Stable version
Copied!
How to start using grade-js CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with grade-js CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/grade-js/1.0.10/grade.min.js"></script>
</head>
<body>
<script>
// Assuming we have two input elements with IDs 'input1' and 'input2'
const input1 = document.getElementById('input1');
const input2 = document.getElementById('input2');
// Initialize Grade.js with a custom comparator function
const grade = new Grade.Grade('input', (a, b) => {
const aValue = parseFloat(a.value);
const bValue = parseFloat(b.value);
return aValue > bValue ? 1 : (aValue < bValue ? -1 : 0);
});
// Attach the grader to the input elements
grade.attach(input1, input2);
// Add an event listener for input changes
input1.addEventListener('input', () => {
grade.compare();
});
// Initialize the grading with some initial values
grade.compare();
</script>
</body>
</html>
Copied!
Copied!
Copied!