195
rated 0 times
[
200]
[
5]
/ answers: 1 / hits: 16864
/ 10 Years ago, fri, october 17, 2014, 12:00:00
I want to calculate the value of the 1st 2 text boxes without a command button
Example i have 3 text boxes.
The first 2, where the numbers will be inputed and the last 1 will be the sum or product and so on.
Now i want it to auto compute.
For example i have inputed values 2 and 3 on the 1st 2 text boxes then automatically the sum or product or whatever result will be displayed on the 3rd text box.
How am i able to do this? Thanks
<html>
<head>
<script src=http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js></script>
<script>
$('#texttwo').keyup(function(){
var textone;
var texttwo;
textone = parseFloat($('#textone').val());
texttwo = parseFloat($('#texttwo').val());
var result = textone + texttwo;
$('#result').val(result.toFixed(2));
});
</script>
</head>
<body>
<input type=text name=value1 id=textone>
<input type=text name=value2 id=texttwo>
<input type=text name=result id=result>
</body>
</head>
More From » jquery