JSFiddle - React, Tailwind, and code Playground

by dtloc

HTML

<form method="POST">
  <label>Tên này:</label>
  <input id="first" type="text"/>
  <br/>
  <label>Thích thì thêm ô nữa:</label>
  <input id="second" type="text"/>
  <br/>
  <input type="button" id="clickme" value="Gửi"/>
</form>

<div id="result"></div>

JavaScript

document.getElementById("clickme").onclick = function() {
	var firstInput = document.getElementById("first").value;
	var secondInput = document.getElementById("second").value;
  var showResultDiv = document.getElementById("result");
  
  var content = "<p>" + firstInput + "</p>" +
  							"<p>" + secondInput + "</p>";
                
	showResultDiv.innerHTML = content;
}