I am very new at HTML/CSS/JavaScript, and I was wondering how I would use a variable that I declared in HTML, and do something with it in JavaScript. In the code below, I created a selection box, and I want to output a message using something along the lines of "if(...) then alert("")". How would I do the equivalent of
if(value == "chrome") {alert("you are using Chrome");}
"Value" is in HTML, but the comparison would be done in JS. Here is the code:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Hello, Internet!</title>
</head>
<body>
<h1>
<p>Webstorm</p>
</h1>
<h2>
<p>Browser ID</p>
</h2>
<h3>
<p>Select which browser this is running on:</p>
<select>
<option>[Select Browser]</option>
<option value = "chrome">Chrome</option>
<!--How would I use "value"? -->
<option value = "firefox">Firefox</option>
<option value = "IE">InternetExplorer</option>
</select>
</h3>
</body>
</html>