I can not figure out how to make so that the active color was only one pressed button. Now just the color is added to each button after clicking
$('.view-btn').click(function(){ $(this).css("background", "#0074d6"); }); .view-btn { cursor: pointer; padding: 15px; color: #fff; background: blue; display: inline-block; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="view-btn"> * </div> <div class="view-btn"> * </div> <div class="view-btn"> * </div>