I have two buttons I want to do so that when the first button is pressed, its background changes (for example, red) and the background color of the second button becomes white and vice versa when the second button is pressed, the background color of the second button becomes red, and the color of the first button becomes white
<template>
<div class="btn-group">
<div>
<button>First Click</button>
</div>
<div>
<button>Second Click</button>
</div>
</div>
</template>
<script>
export default {
isCheck: false,
};
</script>
<style scoped>
.btn-group div button {
background: white;
color: red;
padding: 10px;
}
</style>
You can also see the given code in codesandbox
I edited my question, forgot to emphasize two more nuances, the initial background color of the buttons is white, besides, when you click on a specific button, the button text color should change, the original button color is red when you click on it, the text color should change to white