Convert Marks To Grades And Points - jQuery Result Processing
File Size: | 4.09 KB |
---|---|
Views Total: | 1185 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Result Processing is a small GPA conversion/calculation tool which automatically converts marks into grades and Grade Point Averages for education apps.
How to use it:
1. Download and include the process.js
script after jQuery.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"> </script> <script src="js/process.js"></script>
2. Define the mark in the data-mark
attribute:
<p data-mark="65"></p> <p data-mark="78"></p> <p data-mark="80"></p> <p data-mark="95"></p> <p data-mark="100"></p>
3. Call the function calculateResult
and done.
$(function(){ $('p').calculateResult(); });
4. This will result in...
<p data-mark="65">Mark: 65, Grade: A-, Point: 3.5</p> <p data-mark="78">Mark: 78, Grade: A, Point: 4</p> <p data-mark="80">Mark: 80, Grade: A+, Point: 5</p> <p data-mark="95">Mark: 95, Grade: A+, Point: 5</p> <p data-mark="100">Mark: 100, Grade: A+, Point: 5</p>
5. Specify the passmark from which the plugin checks the mark (greater then or equal).
$('p').calculateResult({ passmarks: 33 });
6. Customize the conversion/calculation rules.
$('p').calculateResult({ marks: [80, 70, 60, 50, 40, 33], grades: ['A+', 'A', 'A-', 'B', 'C', 'D'], points: [5.00, 4.00, 3.50, 3.00, 2.00, 1.00, 0.00] });
7. Do something after the GPA conversion/calculation is completely finished.
$('p').calculateResult({ success: function(response) { var result = response, mark = response.mark; console.log(response); console.log(mark + 10); } });
This awesome jQuery plugin is developed by bjayanta. For more Advanced Usages, please check the demo page or visit the official website.