I've made a random brand generator where you click a button and it returns a brand. I'd like it if each of the brand names that were generated, when clicked, opened the brands website in a new tab. I'm not sure if this is possible, and if it is, whether it should be done in HTML or javascript. Thanks for your help!
HTML
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Brandomiser</title>
<link href='https://fonts.googleapis.com/css?family=Martel:900' rel='stylesheet' type='text/css'>
<link href="main.css" rel="stylesheet" type="text/css">
<link href="/downloads/favicon.ico" />
</head>
<body>
<div class="row">
<div id="bar" class="col-12 col-t-12 col-d-12 col-b-12">
<p id="brand">Brandomiser</p>
</div>
</div>
<div class="row">
<div class="col-12 col-t-12 col-d-12 col-b-12">
<h1 id="myRandomDiv"></h1>
</div>
</div>
<div class="row">
<div id="buttonmiddle" class="col-12 col-t-12 col-d-12 col-b-12">
<button type="button" id="myButton">Hit me.</button>
</div>
</div>
<script src="thing.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
Javascript
var randomStrings = [
"Endsleigh",
"Colgate",
"Shell",
"Tesco",
"Swatch",
"Vanish",
];
var randomDiv = document.getElementById("myRandomDiv");
document.getElementById("myButton").addEventListener("click", generate);
function generate() {
randomIndex = Math.ceil((Math.random() * randomStrings.length - 1));
newText = randomStrings[randomIndex];
randomDiv.innerHTML = newText;
}
generate();