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

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

#1

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!


#2

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?


#3

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


#4

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.. */
  }

#5

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