【发布时间】:2015-11-02 07:06:28
【问题描述】:
我需要一个简单的解决方案来获取包含给定文本的 DOM 标记。
例如。
<body>
<div id='example'>Hello world!</div>
</body>
<script>
function GetTagInfo('Hello');
//I wan't it to return the div as the object so I'll next update the //content with another text.
</script>
我不想使用任何正则表达式,我需要干净简单的代码。
【问题讨论】:
-
您想询问页面上的每个元素,而不仅仅是
divs? -
我们为什么要在这里发布解决方案。这个问题不符合标准。 我需要简洁的代码。 == 给我代码。到 OP。欢迎来到 SO。你读过这部分内容吗?它解释了如何在 Stack Overflow 上写一个好问题?如果没有,请阅读:*.com/help/how-to-ask 和/或 *.com/help/mcve
-
抱歉我的错误。这是我的第一篇文章。非常感谢您的来信。
标签: javascript jquery html dom jquery-selectors