Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.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
Laravel4-动态表使用jquery显示/隐藏数据_Jquery_Html_Laravel 4_Mouseover_Dynamic Tables - Fatal编程技术网

Laravel4-动态表使用jquery显示/隐藏数据

Laravel4-动态表使用jquery显示/隐藏数据,jquery,html,laravel-4,mouseover,dynamic-tables,Jquery,Html,Laravel 4,Mouseover,Dynamic Tables,我已经用foreach创建了一个动态表。我想在“鼠标悬停”每一行时显示一些数据,并在“鼠标悬停”时再次隐藏它。我的代码: @foreach($actividads as $p) <tr id="{{ $p->id }}"> <td> <table class="table"> <td>

我已经用
foreach
创建了一个动态表。我想在“鼠标悬停”每一行时显示一些数据,并在“鼠标悬停”时再次隐藏它。我的代码:

@foreach($actividads as $p)

            <tr id="{{ $p->id }}">
                <td>
                    <table class="table">
                        <td>
                        </td>
                    </table>
                </td>
                <td>
                    <div id="content{{ $p->id }}" class="hidden">
                        <button type="button" class="btn btn-danger pull-right">Action</button>
                    </div>
                </td>
            </div>
            </tr>

@endforeach
我在jQuery中调用'id'时遇到了一些问题,因为如果我尝试使用普通的id(而不是变量),它可以工作

我将感谢任何帮助!!谢谢

我的解决方案:

@foreach($actividads as $p)

            <tr data-id="{{ $p->id }}" class="myclass">
                <td>
                    <div id="content{{ $p->id }}" class="hidden">
                        <button type="button" class="btn btn-danger pull-right">Action</button>
                    </div>
                </td>
我希望它能帮助别人

@foreach($actividads as $p)

            <tr data-id="{{ $p->id }}" class="myclass">
                <td>
                    <div id="content{{ $p->id }}" class="hidden">
                        <button type="button" class="btn btn-danger pull-right">Action</button>
                    </div>
                </td>
$(document).on({
        mouseenter: function () {
            var mostrar = $(this).data('id');
            var mostrar_id = 'content'+ mostrar;
            // alert(mostrar_id);
            $("#" + mostrar_id).removeClass("hidden");
        },

        mouseleave: function () {
            var mostrar = $(this).data('id');
            var mostrar_id = 'content'+ mostrar;
            // alert(mostrar_id);
            $("#" + mostrar_id).addClass("hidden");
        }
    }, ".myclass");