I'm completely new to the world of JavaScript. Currently, I'm working on a web project where I want to dynamically change the styles of two div elements based on select/option values. Sadly, when I try to merge the codes together, it just won't cooperate.
Here's the code snippet:
<html>
<head>
<style>
div {
width:100px;
height:50px;
border:1px solid Black;
margin:10px; padding:6px;
}
select {
width:150px;
height:30px;
}
</style>
</head>
<body>
<div class="Box1" id="Box1"> This is the First Box. </div>
<div class="Box2" id="Box2"> This is the Second Box. </div>
// Rest of HTML and script omitted for brevity...
I attempted various methods but as far as I can tell, they all turned out incorrectly:
- Trying to link both source files.
- Efforts to consolidate them into a single script (either with function() or combining variables).
- Placing them as separate scripts within an HTML document.
EDIT: It seems to only affect changes in the second box.
EDIT: This is part of my efforts to create a web button generator on my alternate domain hosting site.