How To Multiply Two Values Without Clicking A Button - Javascript
Here is my fiddle http://jsfiddle.net/YFgkB/6/
Solution 1:
Working DEMO
Try this
$("#input2,#input1").keyup(function () {
$('#output').val($('#input1').val() * $('#input2').val());
});
Solution 2:
Use onkeyup="calc()"
on input
elements
<inputtype="text" name="input1"id="input1" onkeyup="calc()"value="5">
<inputtype="text" name="input2"id="input2" onkeyup="calc()" value="">
Solution 3:
using jquery..
try this
$('#input1,#input2').keyup(function(){
var textValue1 =$('#input1').val();
var textValue2 = $('#input2').val();
$('#output').val(textValue1 * textValue2);
});
Solution 4:
you can call calc()
function on blur
event
functioncalc(){
var textValue1 = document.getElementById('input1').value;
var textValue2 = document.getElementById('input2').value;
if($.trim(textValue1) != '' && $.trim(textValue2) != ''){
document.getElementById('output').value = textValue1 * textValue2;
}
}
$(function(){
$('#input1, #input2').blur(calc);
});
Solution 5:
Try this!
functionadd() {
var x = parseInt(document.getElementById("a").value);
var y = parseInt(document.getElementById("b").value)
document.getElementById("c").value = x * y;
}
Enter 1st Number :
<inputtype="text"id="a"><br><br>Enter 2nd Number :
<inputtype="text"id="b"onkeyup="add()"><br><br>Result :
<inputtype="text"id="c">
Post a Comment for "How To Multiply Two Values Without Clicking A Button - Javascript"