Created
April 28, 2016 01:01
-
-
Save evdokimovm/8bad6e88b73769edcbc15594bbfe209d to your computer and use it in GitHub Desktop.
Passing HTML input value as a JavaScript Function Parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
</head> | |
<body> | |
a: <input type="number" name="a" id="a"><br> | |
b: <input type="number" name="b" id="b"><br> | |
<button onclick="add(document.getElementById('a').value, document.getElementById('b').value)">Add</button> | |
<script type="text/javascript"> | |
function add(a, b) { | |
var sum = parseInt(a) + parseInt(b); | |
alert(sum); | |
} | |
</script> | |
</body> | |
</html> |
mitm786
commented
Jun 20, 2020
<title>multiple parameters function javascript</title>
Click
<script type="text/javascript">
function myfunctionName( name,age ){
document.getElementById("result").innerHTML += name;
document.getElementById("ageshow").innerHTML += age;
}
</script>
more learn about main points with the example of [How to Pass Parameter in JavaScript Function From Html](https://wlearnsmart.com/how-to-pass-parameter-in-javascript-function-from-html/)
<3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment