<!DOCTYPE HTML> <html> <head> <title>Untitled</title> <meta charset="utf-8"> <script type='text/javascript' src='http://code.jquery.com/jquery-1.10.2.js'></script> <input type="text" maxlength="10" name="price" value=""> <form id="form_calculator_price_to_uah" onsubmit="return false;" oninput="document.getElementById('rezultat').innerHTML= parseFloat(document.getElementById('a').innerHTML)*parseFloat(document.getElementById('b').innerHTML)"> <span id="a"></span>x <span id="b" style="padding: 0; margin: 0; font-weight: bold;">17</span>= <span id="rezultat">N/A</span>грн.</form> <script> $('input[name="price"]').keyup(function () { var value = $(this).val(); $('#a').text(value); }); </script> </body> </html>
<!DOCTYPE HTML> <html> <head> <title>Untitled</title> <meta charset="utf-8"> </head> <body> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <form id="form_calculator_price_to_uah" onsubmit="return false;" oninput="document.getElementById('rezultat').innerHTML= parseFloat(document.getElementById('a').innerHTML)*parseFloat(document.getElementById('b').innerHTML)"> <input type="text" maxlength="10" name="price" value=""> <span id="a"></span>x <span id="b" style="padding: 0; margin: 0; font-weight: bold;">17</span>= <span id="rezultat">N/A</span>грн.</form> <script> $('input[name="price"]').on("input",function () { var value = $(this).val(); $('#a').text(value); }); </script> </body> </html>