如何通过查找函数及其 ID 访问和操作 HTML 表

how can i visit and manipulate a html table by find function and its id?

本文关键字:访问 操作 HTML ID 何通过 查找 函数      更新时间:2023-09-26

源代码站点:在此处输入链接说明

var table = $(data).find("table").removeAttr("width");

我可以使用表格,因为只有一个表格标签:... 。但是如果html中有两个表,如何访问一个表(该表有一个id),例如:

<table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" id="item">...</table>

谢谢你思考我的问题。谢谢。

您可以在查找中指定 id:

var table = $(data).find("table#item").removeAttr("width");