I'm currently in the process of building an application with Bootstrap and VueJS.
My goal is to create a folder structure similar to Google Drive, where I want to make a div stand out in blue once it's selected.
Below is the code snippet:
export default{
mounted(){
$(document).ready(function () {
let that = this;
$("#div").on("click", ".folderRectangle", function () {
$(that).css("background-color", "blue");
$(".folderRectangle").not(that).css("background-color", "white");
});
});
}
}
.folderRectangle {
x: 220px;
y: 473px;
width: 299px;
height: 62px;
background-color: #FFFFFF;
border: 1px solid #BDBDBD;
border-radius: 0px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div class="row">
<div class="col-xl-3 col-md-6">
<stats-card>
<div slot="header" class="folderRectangle" id="div">
<div class="row">
<div class="col-3">
<div class="clearfix">
<i class="material-icons" id="folder-image"></i>
</div>
</div>
<div class="col-9">
<div class="clearfix" style="position: relative">
<div>
<p style="text-align: left">Folder Name</p>
</div>
<div>
<p style="text-align:left">20 files</p>
</div>
</div>
</div>
</div>
</div>
</stats-card>
</div>
<div class="col-xl-3 col-md-6">
<stats-card>
<div slot="header" class="folderRectangle" id="div">
<div class="row">
<div class="col-3">
<div class="clearfix">
<i class="material-icons" id="folder-image"></i>
</div>
</div>
<div class="col-9">
<div class="clearfix" style="position: relative">
<div>
<p style="text-align: left">Folder Name</p>
</div>
<div>
<p style="text-align:left">20 files</p>
</div>
</div>
</div>
</div>
</div>
</stats-card>
</div>
</div>
Despite attempting to change the CSS color of the div through onClick, I am encountering difficulties. Can someone offer guidance on what may be causing this issue?