JSFiddle - React, Tailwind, and code Playground
HTML
<div id = "results1">
<ul id = "results">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
<input id="save-txt" class="button" type="button" value="Save to text" />
JavaScript
$('#save-txt').click(function() {
window.open(
'data:text/csv;charset=utf-8,' +
escape(
$('#results li') // <- selector for source data here
.map(function(){
// format row here
return $(this).text();
})
.get()
.join('\r\n')
)
);
});