Seeking assistance in modifying the background color of a div upon clicking a button. Below are the relevant code snippets.
<div id="example1" runat="server">
</div>
Accompanying CSS for the above HTML:
#example1 {
position: absolute;
z-index: 5;
top:0;
background-color: orange;
width: 310px;
height: 34px;
color: white;
border-radius: 4px;
}
The desired changes:
#example2 {
position: absolute;
z-index: 5;
top:0;
background-color: red;
width: 380px;
height: 38px;
color: white;
border-radius: 4px;
}
Attempted solution in Page.aspx.cs:
example1.CssClass = "example2";
Encountering issues as CssClass seems not to be recognized. How can this be resolved or is there an alternative method using C#?