jquery - Is it possible to make parseFloat from several textboxes? -


is possible read , handle numerical values 2 textboxes, using parsefloat? such code not work me. suspect problem somehow connected second textbox?!

<div style="padding:10px;">     enter number 1: <input class="textbox" value=""/> </div> <div style="padding:10px;">     enter number 2: <input class="textbox2" value=""/> </div> <div>     <button id="get">calculate</button>  </div> <div>     <h4>result: <label id="msg"></label></h4> </div>  <script type="text/javascript"> $("button:#get").click(function () {     var num1 = parsefloat($('input:textbox').val());     var num2 = parsefloat($('input:textbox2').val());     var result = ((num1 * num2));     $('#msg').html(result); }); </script> 

the problem selectors.

$(document).on('click','button#get',function () {             var num1 = parsefloat($('input.textbox').val());     var num2 = parsefloat($('input.textbox2').val());     var result = ((num1*num2));      $('#msg').html(result);   }); 

this work independent of position of script tag.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -