JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.2.min.js"></script>
<label for="lamp">LAMP:</label>
<select id="lamp">
<option>Select</option>
<option value="1">ON</option>
<option value="0">OFF</option>
</select>
<br/>
<br/>
<label for="blower">BLOWER:</label>
<select id="blower">
<option>Select</option>
<option value="1">ON</option>
<option value="0">OFF</option>
</select>
<br/>
<input type="button" id="generate" value="GENERATE"/>
JavaScript
$("#generate").on("click", function(e){
var lamp = $("#lamp").val();
var blower = $("#blower").val();
if (lamp == "Select") {
alert("Please select a value for LAMP");
}
if (blower == "Select") {
alert("Please select a value for BLOWER");
}
if ((lamp != "Select") && (blower != "Select")) {
var text = lamp.toString()+blower.toString();
var file = "data:text/plain," + text;
var a = document.createElement("a");
a.download = e.target.value + "-" + new Date().getTime();
a.href = file;
document.body.appendChild(a);
a.onclick = function() {
this.parentElement.removeChild(this)
};
a.click();
}
});