Я хочу экспортировать переменную jquery в виде файла html при нажатии кнопки со следующим кодом.
var html = buildSource(htmleditor, jseditor, csseditor);
$('#hitbookmark').click(function(){
downloadInnerHtml(html, 'main','text/html');
});
function downloadInnerHtml(filename, elId, mimeType) {
var elHtml = html;
mimeType = mimeType || 'text/plain';
link.setAttribute('download', filename);
link.setAttribute('href', 'data:' + mimeType + ';charset=utf-8,' + encodeURIComponent(elHtml));
link.click();
}
, пожалуйста, предложите, как это сделать?