jquery - javascript multiply input by number -


i'm trying create simple function table have been tasked creating. want user enter number first input field, , have number multiplied 30, , have result show in second input field, keyup or onchange.

here's have far, please keep in mind i'm very new @ this.

<table>     <tr>         <td>costs</td>         <td>$             <input type="text" id="daily">         </td>         <td>$             <input type="text" id="result">         </td>     </tr> </table>  <script> $(function () {     $('#daily').keyup(function () {         var daily = $('#daily').val();         var month = 30;         $('#result').val(daily * month);     }); }); </script> 

$(function () {    $('#daily').on('keyup', function (){      var daily = parseint($('#daily').val());      var month = 30;      $('#result').val(daily * month);    }); }); 

i tried use ".on" binding instead of directly using ".keyup" because prevent errors if table result of ajax call


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -