I'm quite new to this. I need to change the popup.html that gets shown in my chrome extension. I have two popup.htmls. I also need to save the value of the users choice.
My options.html:
<html>
<head>
<script src="options.js"></script>
</head>
<body>
<label class="paylabel" for="cardtype">Theme:</label>
<select id="cardtype" name="cards">
<option value="selectcard">--- Please select ---</option>
<option value="op1">first</option>
<option value="op2">second</option>
</select>
<input type="button" onclick="fun()" value="click here">
</body>
</html>
options.js:
function fun()
{
var ddl = document.getElementById("cardtype");
var selectedValue = ddl.options[ddl.selectedIndex].value;
if (selectedValue == "op2")
{
chrome.browserAction.setPopup({
popup: 'popup2.html'
});
}
}
My manifest.json:
{
"manifest_version": 2,
"name": "extension name",
"options_page": "options.html",
...
}
This question is not a duplicate, because in my question I'm trying to figure out how to display different popup.htmls according to the users choice. The other question is trying to identify why the onclick function doesn't work within the chrome extension.