1
I have the following code. This code contains 5 Ivs where when clicking on each one ,the one that was clicked receives a background value.I want that after clicking one of them,in the next click, the one that was clicked lose the beckground without changing the others.
EX.:I clicked on div 1 ,turned red. I clicked on div 2 ,turned red,I clicked on div 1 lost the red color ,but 2 must continue red.
$(function () {
$('.Classe').click(function () {
$(this).css('background','red');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<div class="Classe">valor 1</div>
<div class="Classe">valor 2</div>
<div class="Classe">valor 3</div>
<div class="Classe">valor 4</div>
<div class="Classe">valor 5</div>
<html/>