Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/400.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用jquery将内容从面板提取到模式_Javascript_Php_Jquery_Twitter Bootstrap_Bootstrap Modal - Fatal编程技术网

Javascript 如何使用jquery将内容从面板提取到模式

Javascript 如何使用jquery将内容从面板提取到模式,javascript,php,jquery,twitter-bootstrap,bootstrap-modal,Javascript,Php,Jquery,Twitter Bootstrap,Bootstrap Modal,我已经做了一个个人资料页面,上面显示了用户的帖子,用户可以执行删除或编辑帖子的功能。但是 当我在我的任何一篇文章上单击edit post时,只有第一篇文章的内容在模式中被获取 我的js代码: $('.dropdown-menu').find('.edit').on('click', function(e) { e.preventDefault(); var postbody = $('#fetch').find('p').text(); $('#post-body').val(p

我已经做了一个个人资料页面,上面显示了用户的帖子,用户可以执行删除或编辑帖子的功能。但是

当我在我的任何一篇文章上单击edit post时,只有第一篇文章的内容在模式中被获取

我的js代码:

$('.dropdown-menu').find('.edit').on('click', function(e) {
  e.preventDefault();

  var postbody = $('#fetch').find('p').text();

  $('#post-body').val(postbody);
  $('#edit-modal').modal();
});
我的视图代码:

@foreach($posts as $post) @if(Auth::user()== $post->user)

<div class="panel panel-default">
  <div class="panel-heading">
    <div class="row">
      <section class="col-md-2 col-xs-2">
        <img id="imagesize2" src="images/g.jpg" class="img-circle" data- action="zoom" />

      </section>
      <section class="col-md-5 col-xs-offset-1 col-xs-5">
        <a id="alink13" href=""><h5 id="alink14">{{$post->user->firstname}}</h5> </a>
        <p>on {{$post->created_at}}</p>
      </section>
      <section class="col-md-offset-3 col-md-2 col-xs-4 col-lg-offset-1">
        <div class="btn-group">
          <button id="btnclr4" type="button" class="btn btn-default dropdown- toggle" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon  glyphicon-chevron-down"></span>
          </button>
          @if(Auth::user()==$post->user)
          <ul id="remove" class="dropdown-menu" role="menu">
            <a id="remove2" href="{{route('post.delete',['post_id' => $post->id])}}">
              <li role="presentation">Remove This Post</li>
            </a>
            <a href="" class="edit">
              <li role="presentation">Edit This Post</li>
            </a>
          </ul>
          @endif


      </section>
      </div>
    </div>
    <div class="panel-content">
      <div class="row" id="fetch">
        <section class="col-md-12">
          <p>{{$post->body}}</p>
        </section>
      </div>
    </div>
@foreach($posts as$post)@if(Auth::user()==$post->user)
在{{$post->created_at}

@如果(Auth::user()=$post->user)
@恩迪夫 {{$post->body}


只有一个
#fetch
内,因此不确定我们应该如何知道除此之外要查找什么。少了点什么here@charlietfl抱歉,没有找到您。只有一个
#fetch
内,因此不确定我们应该如何知道除此之外要查找什么。少了点什么here@charlietfl对不起,我没听懂你的话。