title: JavaScript showing previously on clicked data
body: <p>I am showing data using modal. In the modal I am showing data dynamically that are fetching from database. For back-end I am using Laravel. For showing data to the modal dynamically I have created a function in the button where on clicking modal is opening. Here is the button. </p>
  
  <pre><code>&lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal" onclick="sendData('{!!$singleWorkout-&gt;title!!}', '{!!$singleWorkout-&gt;image!!}')"&gt;View&lt;/button&gt;
  </code></pre>
  
  <p>Here I am sending dynamic data to the <code>sendData</code> function. 
  Here is my <code>sendData</code> function code.</p>
  
  <pre><code>function sendData(title, image) {
  $('#modal-title').append(title);
  $('#modal-image').append('&lt;img src="/file/'+image+'" height="200px" width="100%"&gt;');
  }
  </code></pre>
  
  <p>This function appending data to my modal dynamically.</p>
  
  <p>Here is my modal code.  </p>
  
  <pre><code>&lt;div class="modal fade" id="myModal" role="dialog"&gt;
  &lt;div class="modal-dialog"&gt;
  
    &lt;!-- Modal content--&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
        &lt;h4 class="modal-title"&gt;
          &lt;div id="modal-title"&gt;
  
          &lt;/div&gt;
        &lt;/h4&gt;
      &lt;/div&gt;
      &lt;div class="modal-body" id="modal-image"&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        &lt;p&gt;Some text in the modal.&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now the problem is, if I click on the <code>view</code> button for opening modal its worked fine for the first click. If I click on the button again then it shows newly clicked data also shows previously clicked data. So my question is how I can stop showing that previously clicked data.</p>