title: How to fetch content from panel to modal using jquery
body: <p>I've made a profile page on which user's posts are displayed, user can perform function delete or edit post.But,</p>
  
  <p>when i click on edit post on any of my post ,only content of first post is fetched in the modal.</p>
  
  <p>my js code:</p>
  
  <pre><code>$('.dropdown-menu').find('.edit').on('click', function(e) {
    e.preventDefault();
  
    var postbody = $('#fetch').find('p').text();
  
    $('#post-body').val(postbody);
    $('#edit-modal').modal();
  });
  </code></pre>
  
  <p>my view code:</p>
  
  <pre><code>@foreach($posts as $post) @if(Auth::user()== $post-&gt;user)
  
  &lt;div class="panel panel-default"&gt;
    &lt;div class="panel-heading"&gt;
      &lt;div class="row"&gt;
        &lt;section class="col-md-2 col-xs-2"&gt;
          &lt;img id="imagesize2" src="images/g.jpg" class="img-circle" data- action="zoom" /&gt;
  
        &lt;/section&gt;
        &lt;section class="col-md-5 col-xs-offset-1 col-xs-5"&gt;
          &lt;a id="alink13" href=""&gt;&lt;h5 id="alink14"&gt;{{$post-&gt;user-&gt;firstname}}&lt;/h5&gt; &lt;/a&gt;
          &lt;p&gt;on {{$post-&gt;created_at}}&lt;/p&gt;
        &lt;/section&gt;
        &lt;section class="col-md-offset-3 col-md-2 col-xs-4 col-lg-offset-1"&gt;
          &lt;div class="btn-group"&gt;
            &lt;button id="btnclr4" type="button" class="btn btn-default dropdown- toggle" data-toggle="dropdown" aria-expanded="false"&gt;&lt;span class="glyphicon  glyphicon-chevron-down"&gt;&lt;/span&gt;
            &lt;/button&gt;
            @if(Auth::user()==$post-&gt;user)
            &lt;ul id="remove" class="dropdown-menu" role="menu"&gt;
              &lt;a id="remove2" href="{{route('post.delete',['post_id' =&gt; $post-&gt;id])}}"&gt;
                &lt;li role="presentation"&gt;Remove This Post&lt;/li&gt;
              &lt;/a&gt;
              &lt;a href="" class="edit"&gt;
                &lt;li role="presentation"&gt;Edit This Post&lt;/li&gt;
              &lt;/a&gt;
            &lt;/ul&gt;
            @endif
  
  
        &lt;/section&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="panel-content"&gt;
        &lt;div class="row" id="fetch"&gt;
          &lt;section class="col-md-12"&gt;
            &lt;p&gt;{{$post-&gt;body}}&lt;/p&gt;
          &lt;/section&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>