社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Jquery

jquery选择多个类并提取数据

findtail • 6 年前 • 1803 次点击  

我想从多个类元素中的数据标签中提取数据。each()函数是最好的方法吗?

jQuery:

$('#copymodal').on('show.bs.modal', function (event) {

            $(".copy19").each(function(){
                var a = data('total');
                alert(a);
            });
       })

HTML:

<a class='copy19' href='#'            
      data-statementid="14"
      data-total="98078"
      data-toggle="modal" 
      data-target="#editmodal">
      Edit
</a>

<a class='copy19' href='#'            
      data-statementid="16"
      data-total="78078"
      data-toggle="modal" 
      data-target="#editmodal">
      Edit
</a>
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/43501
文章 [ 3 ]  |  最新文章 6 年前