I have a form with one dropdown list and I want when the user click on the save button to save the value of the selected option in a text file. The user can open the form several times and add others options. It should write the option in the same text file at the end of the previous data.
<form>
<div class="form-inline">
<select name="option" id="data" class="form-control"></select>
</div>
</form>
<button type="button" onclick="saveToTextFile()" class="btn btnsecondary">Save</button>
function saveToTextFile() {
var x = document.getElementById("data").selectedIndex;
var y = document.getElementsByTagName("option")[x].value;
var blob = new Blob([y],
{type: "text/plain;charset=utf-8"});
saveAs(blob, "static.txt");}
Any advice ? Thank you !