JQuery - Increase value output for each 50 entered -


i've got simple text box users enter number - update multiple elements on page value.

at moment script multiple number entered set amount.

    $('input').keyup(function() {         var v = $(this).val();         v = isnan(v)?'':v;         $(this).val(v);         $("#spot1 span").html(v * 100);         $('#spot2 span').html(v * 200);     }); 

html:

    <div><input id="number" name="number" type="text"><br /></div>      <div id="spot1">section 1:  <span></span><br /></div>     <div id="spot2">section 2:  <span></span><br /></div> 

what have output section 2 based on increasing in digest times x entered input box

eg. less 50 section 2 shows 1, , every 50 entered increases 1. so, if number 250 entered, section 2 show 4

use division in-line, try sample entering in '250'

$('input').keyup(function() {          var v = $(this).val();          v = isnan(v)?'':v;          $(this).val(v);          $("#spot1 span").html(v);          $('#spot2 span').html(math.ceil((v * 4)/250));      });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div><input id="number" name="number" type="text"><br /></div>        <div id="spot1">section 1:  <span></span><br /></div>      <div id="spot2">section 2:  <span></span><br /></div>


Comments

Popular posts from this blog

html - How can i make an element from a bottom stacking context stays in front of another higher stacking context? -

python - TypeError: start must be a integer -

html - href attribute breaking an element -