0

How can i add a reset button for delete/reset? when i click a color, adding a background style to .class-bg and i want to reset/delete this style with reset button?

$(document).ready(function () {
    var colors = ['feff35','fff600','ffe800','d0eb2c','aed14f','40aa48','71cde3'];
 

 $ClassBg = $('.color-class-bg'), $stageClassBg = $('.class-bg'),
    $.each(colors, function (i, color) { $ClassBg.append('<div class="color-square" style="background:#' + color + ';"></div>'); });
    $ClassBg.on('click', '.color-square', function (event) { $stageClassBg.css('background', $(this).css('backgroundColor')); });

 
});
.color-square{display:inline-block;width:28.75px;height:28.75px;margin: 0 0 -3px 0;cursor:pointer;text-align:center;transition: .1s ease;}
.color-square:hover{box-shadow:0 5px 20px rgba(0, 0, 0, 0.8);transform: translateY(0px) scale(1.70);}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<p class="color-class-bg"></p>
<p class="class-bg">CONTENT</p>
<a href="#" class="reset">reset style</a>
ercan
  • 101
  • 1
  • 1
  • 7
  • Are you trying to remove a style added with jquery's `.css()` function? http://stackoverflow.com/questions/4036857/jquery-remove-style-added-with-css-function – Nathan Feb 25 '15 at 20:22
  • thanks @Nathan bu i dont understand how can i do a reset button for this. Sorry i am just an amator. – ercan Feb 25 '15 at 20:53

0 Answers0