JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<input type="text" value="default" />
<select>
<option>Op1</option>
<option selected="true">Op2</option>
</select>
<select multiple="true" size="5">
<option>Op1</option>
<option selected="true">Op2</option>
</select>
<input type="button" value="reset" />
</div>
JavaScript
$("#container :text").each(function() {
var $this = $(this);
$this.data("default", $this.val());
});
$("#container select option").each(function() {
var $this = $(this);
$this.data("default", $this.is(":selected"));
});
$("#container :button").click(function() {
$("#container :text").each(function() {
var $this = $(this);
$this.val($this.data("default"));
});
$("#container select option").each(function() {
var $this = $(this);
$this.attr("selected", $this.data("default"));
});
});