JSFiddle - React, Tailwind, and code Playground

by huuzoo

HTML

<div>
<input type="text" id="form1"><input type="button" value="クリア" onclick="clearText()" />
</div>

<div>
<textarea id="form2" cols="30" rows="4"></textarea><input type="button"  value="クリア" onclick="clearTextarea()" />
</div>

CSS

div {
  margin-bottom:20px;
}

JavaScript

function clearText() {
	var textForm = document.getElementById("form1");
  textForm.value = '';
}

function clearTextarea() {
	var textareaForm = document.getElementById("form2");
  textareaForm.value = '';
}