Skip to content

Instantly share code, notes, and snippets.

@omernaci
Created August 15, 2018 08:23
Show Gist options
  • Save omernaci/b1a66bf6a5af90a39ca4bc9007fdf070 to your computer and use it in GitHub Desktop.
Save omernaci/b1a66bf6a5af90a39ca4bc9007fdf070 to your computer and use it in GitHub Desktop.
call a function with arguments
<!DOCTYPE html>
<html>
<body>
<p>Click "Try it" to call a function with arguments</p>
<button onclick="myFunction('Harry Potter','Wizard')">Try it</button>
<p id="demo"></p>
<script>
function myFunction(name,job) {
document.getElementById("demo").innerHTML =
"Welcome " + name + ", the " + job + ".";
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment