P☺m☺ - The Pomodoro Timer, Feed-(me)-back please!

Christmas is here and so is my ‘Pomo The Timer’ ! First of all, Merry Christmas! Second of all, check this out and tell me about it.


Happy Holidays!

Good work and marry christmas to you! Just a little question, why you don’t handle the “onchange” event on the input to prevent it to go under negative values instead of alert?

1 Like

Well I did what I knew. Guide me please with the ‘onchange’ event if you can :slight_smile:

You have two ways to do it.

  1. HTML
    <input type="number" min="1" max="60" />

  2. JavaScript

  $('#inputMinutes').on ('change', valid_input); /* Change with arrows keys or manual insertion */
  $('#inputMinutes').on ('input', valid_input); /* Change on click "up" or "down" button */
  
  function valid_input (e) {
    e.preventDefault ();
    
    if ( +e.target.value < 1 )
      e.target.value = 1;
    
    /* valid.. */
  }
1 Like

Thank you very much for your effort! The HTML method looks simpler than JavaScript one. Happy holidays! :slight_smile: