相关疑难解决方法(0)

如何使用相同的ID检测单击的div文本

$(document).ready(function(){

    $('#peoplelayer').click(function(){
        $("#peoplelayer").each(function(){

            $("#peoplelayer").fadeOut(500);
            var str = $(this).text();
            alert(str);
            //$("#peoplelayer").fadeTo(500,0.6);

            });

    });
});
Run Code Online (Sandbox Code Playgroud)

这是代码,我对所有div使用相同的id"#peoplelayer",当我点击其中一个时,它会以相同的id警告这个div的所有文本

我怎么能防止这个问题,因为我需要提醒只有被点击的div,除了我需要给这个divs相同的id ???

html javascript jquery

1
推荐指数
1
解决办法
179
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1