I have a bunch of input elements and with javascript on click i'm getting the values of these inputs and paste it in a div somewhere
Please run the code snipped below to check
$('#getthelist').click(function() {
  $('.inputs>li .color').map(function() {
    return {
      name: this.closest('[id]').id,
      value: $(this).val()
    }
  }).get().forEach(function(e) {
    $('.list').append('<div>' + '\"' + e.name + '\": \"' + e.value + '\",</div>');
  });
});ul,li {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list {
    margin: 10px;
    width: 270px;
    padding: 25px;
    background-color: #fafafb;
}<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<li id="color_white">
<ul class="inputs">
    <input type="radio" value="getthelist" id="getthelist"> Click to get the color values
  
  <li id="color_white">
   <div>
    <input type="text" value="#fff" class="color">
   </div>
  </li>
  
  <li id="color_black">
   <div>
    <input type="text" value="#000" class="color">
   </div>
  </li>
  
</ul>
<div class="list"></div>So i have got one question and a problem i cant figure out how to fix.
- The problem is, each time you click the button it pastes the values in the divrepeatedly. It is a mess to me for what i'm trying to do. so, How do i force it not to repeat the same values when you click every time.
- Question: How do i copy the input values to clipboardwith the same click function?
 
     
     
     
     
    