Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function totalHours(){
- var start = document.getElementById("starttime").value;
- var end = document.getElementById("finishtime").value;
- var breaks = document.getElementById("breaktime").value;
- var hours = parseTime(end) - parseTime(start);
- var out = (hours / 60) - breaks;
- $('#totalhours').val(out);
- $('#totalhours').trigger('input');
- // document.getElementById("breaktime").value=0;
- function parseTime(s) {
- var c = s.split(':');
- return parseInt(c[0]) * 60 + parseInt(c[1]);
- }
- }
- $(document).ready(function() {
- $("#breaktime").keyup(function(){
- totalHours();
- });
- });
- // function nantest(){
- // var value = document.getElementById("totalhours").value;
- // alert(isNan(value));
- // }
- $(document).ready(function() {
- $("#yourhours").validator({
- custom : {
- hourcheck : function($el) { return Boolean($el.val() >= 1);}
- },
- errors: {
- hourcheck : "Your number of hours must be positive."
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement