title: Change input value dynamically with jQuery
body: <p>I'm trying to change input value and display an alert based on value written by the user. Now it doesn't work unless it goes out of focus. Can I make it work immediately without any waiting period?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>jQuery('input').on('change', function () {
      var myInput = jQuery(this);
      if (myInput.val() &lt; 0.2 ) {
          myInput.val('0.2');
          jQuery('.alert').css('display', 'block')
      }
      else {
          jQuery('.alert').css('display', 'none')
      }
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;input value=""&gt;
  &lt;p class="alert" style="display: none"&gt;minimum value is 0.2&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>