为了账号安全,请及时绑定邮箱和手机立即绑定

jquery 遍历页面class为gname的td 并且得到其中的值并将其高亮显示

jquery 遍历页面class为gname的td 并且得到其中的值并将其高亮显示

慕标琳琳 2018-12-06 23:09:08
html 文本例如:   <table border="0" cellspacing="0" cellpadding="0" width="100%">         <tr>            <td class="gname" width="60%">测试1</td>     <td class="gname" width="60%">xiao1</td>     <td class="gname" width="60%">xiao2</td>         </tr>     </table>
查看完整描述

6 回答

?
慕容森

TA贡献1853条经验 获得超18个赞

$("td .gname").addClass("test");

查看完整回答
反对 回复 2018-12-24
?
潇潇雨雨

TA贡献1833条经验 获得超4个赞

$(function(){ $("td[class='gname']").each(function(){ $(this).css("color","red"); alert($(this).html()); }); });

查看完整回答
反对 回复 2018-12-24
  • 6 回答
  • 0 关注
  • 889 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号