Skip to content

Instantly share code, notes, and snippets.

@chikoski
Created October 23, 2013 10:49
Show Gist options
  • Save chikoski/7116480 to your computer and use it in GitHub Desktop.
Save chikoski/7116480 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<form>
<input type="text" id="input_a" placeholder="一つ目の文章">
<input type="text" id="input_b" placeholder="二つ目の文章">
<input type="button" id="btn_start" value="結合!">
</form>
<div>
<p>結果</p>
<p id="output"></p>
</div>
</body>
</html>
var concat = function(a, b){
return a + " " + b;
};
var calc = function(){
var input_a = document.getElementById("input_a");
var input_b = document.getElementById("input_b");
var output = document.getElementById("output");
var message = concat(input_a.value, input_b.value);
output.textContent = message;
};
var btn = document.getElementById("btn_start");
btn.onclick = calc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment