Getting value in text field and when i click on button it should multiply value by 2 and show result in an other text field.Is it possible?
Here is what i am trying in my code but didn't work!
<title> Task 1 </title>
<script type="text/javascript">
function multi()
{
var temp = document.getElementById('number').value;
temp = temp * 2;
return temp;
}
</script>
Result
Is that what you need ? JsFiddle
<input type="text" id="number" value="5">
<input type="button" value="Double !" onClick="multi()">
<br />
result : <input type="text" id="result" value="">
function multi(value)
{
var temp = document.getElementById('number').value;
temp = temp * 2;
document.getElementById('result').value = temp;
}
Edit : Forgot to put result on another input, it should be now what you requested
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments