title: Update Javascript after value change
body: <p>Right now I have a project that calculates <code>startTime</code>, <code>EndTime</code> - <code>breakTime</code>.
  and displays that into a <code>WorkedHours</code> Field.</p>
  
  <p>Like this:
  <a href="https://i.stack.imgur.com/9KG27.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9KG27.png" alt="enter image description here"></a></p>
  
  <p>I have a time picker to choose the time, but my calculate script dosen't run after I changed the value. It runs when I step into the text box.
  So if I were to change it like this:
  <a href="https://i.stack.imgur.com/zxzKy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zxzKy.png" alt="enter image description here"></a></p>
  
  <p>It will not updated <strong><code>Tid Jobbad</code></strong> Until I step into that same textbox again. How do I make it call the function each time the value changes? </p>
  
  <p>This is the script:</p>
  
  <pre><code>    $(function() {
      $('#breakTime,#startTime,#endTime')
        .blur(CalculateTime);
      CalculateTime();
  });
  
  
  function CalculateTime() {
      try {
          var originalStartTime = $('#startTime').val(),
            originalEndTime = $('#endTime').val(),
            originalBreakTime = $('#breakTime').val();
  
          // breaking hours and minutes. needed format: HH:mm
          var startHours = originalStartTime.substring(0, 2).replace(':', ''),
            startMinutes = originalStartTime.substring(3, 5),
            endHours = originalEndTime.substring(0, 2).replace(':', ''),
            endMinutes = originalEndTime.substring(3, 5);
  
          // momentJs variables
          var mStart = moment().hour(startHours).minute(startMinutes),
            mEnd = moment().hour(endHours).minute(endMinutes),
            mBreak = moment.duration(originalBreakTime);
  
          var result = mEnd.subtract(mStart).subtract(mBreak).format('HH:mm');
  
          $('#workedHours').val(result);
  
      } catch (err) {
          $('#workedHours').val(err);
      }
  }
  </code></pre>