博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jQuery Recipies - 使用map来过滤对应的元素集
阅读量:6907 次
发布时间:2019-06-27

本文共 1286 字,大约阅读时间需要 4 分钟。

Employee Name Department Name Salary
Jane Smith Marketing $95,000
John Smith Technology $90,000
Brian Adam Sales $72,000
Mary Jones Support $60,000
Michael Jefferson Technology $85,000

$("tr:gt(0)") selects all the HTML elements with the tag name "tr" except for the first record and returns the

jQuery object.

.map() iterates through each element from the set of selected elements and processes them in the function.
return $(this).children().first().text() returns the text content of the first child element (td) of each
selected "tr" element, which is the employee name.
A new jQuery object (jqObj) is created that contains elements as a result of the return value of the function.

jqObj.get() gets all the HTML elements from the jQuery object as an array.

.join(", ") joins all elements from the array, delimits them with commas (,) and returns a string that contains
a comma-delimited list of all the employees’ names.

 

转载于:https://www.cnblogs.com/davidgu/p/4271935.html

你可能感兴趣的文章
python中的常用模块
查看>>
linux 学习笔记 防火墙设置
查看>>
Reverse Linked List II
查看>>
upc组队赛1 不存在的泳池【GCD】
查看>>
操作系统概念小结(1)
查看>>
计算两个日期相差年月日
查看>>
py QScrollArea
查看>>
centos 6 升级gcc
查看>>
Maatkit--Mysql的高级管理工具
查看>>
主要的开源镜像站点资源
查看>>
白酒防伪标签生产防窜货二维码制作印刷公司
查看>>
APP测试工具
查看>>
用NULL来构造string会出问题
查看>>
php转化输入日期为Unix 纪元到当前时间的秒数 日期筛选
查看>>
教程-经典Delphi教程网
查看>>
刨根问底:详解Hadoop核心架构(转载)
查看>>
LINUX下C语言编程基础
查看>>
《Python程序设计(第3版)》[美] 约翰·策勒(John Zelle) 第 1 章 答案
查看>>
IDEA 插件-码云
查看>>
Boost::Date_time库和time_from_string()函数的使用
查看>>