I'm new to Google App Script and I'm trying to make a dropdownlist using HtmlService where it'll run a function depending on the value of the selected item. But nothing is happening after clicking the OK button. Here are my codes,
CODE.GS
function getList()
{
var myHtml = HtmlService.createHtmlOutputFromFile('index').setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi().showModalDialog(myHtml, 'Select Your Option');
}
HTML
<head>
<base target="_top">
<script>
document.getElementById("btnGet").onclick = function() {
var e = document.getElementById("menu");
var getMenu = e.options[e.selectedIndex].value;
if (getMenu == "inbox") {
google.script.run.my_scrapper(getMenu);
} else {
return 0;
}
}
</script>
</head>
<body>
<select id="menu">
<option value="inbox">Inbox</option>
<option value="drafts">Drafts</option>
</select>
<br />
<button id="btnGet">OK</button>
</body>
How can I run the function & pass the selected item's value as parameter in the function after I click OK button in google app script? Need this help badly! Thanks.