I have a website where I display a list of properties, such as houses. The layout of this list is created using CSS. I recently created a second CSS class to properly align the properties/houses in two columns. Previously, I achieved this by pressing a button, initiating a postback, and outputting different HTML (similar content with different CSS class references).
While searching for a solution, I came across this question on SO. I decided to implement a basic scenario where a div with the class "yellow" is initially displayed, and clicking a button changes it to "red". However, I noticed that the div quickly reverts back to the "yellow" class.
Although I am new to JavaScript, I have experience in programming. Integrating this feature into my website would be beneficial, but I haven't been able to find a suitable solution yet. I apologize if this query has already been addressed elsewhere.
<script type="text/javascript">
function changeView() {
document.getElementById("box").className = " red";
}
Thank you in advance, Christophe.