No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.babelrc
.gitignore
LICENSE
README.md
build.js
package.json

README.md

#getElementsByText

This method is to get elements that contains the text.

Usage

document.getElementsByText(text);

or

Element.getElementsByText(text);

Example

<html>
<head>
	<title>ABCDEF</title>
</head>
<body>
	<p>AB<span>CD</span>EF</p>ABCD
</body>
</html>
document.getElementsByText('CD'); // -> [<title>, <span>, <body>]
document.body.getElementsByText('AB'); // -> [<p>, <body>]
document.body.getElementsByText('CDE'); // -> null

Install

<script src="getElementsByText.js"></script>

build.js is getElementsByText.js.

Licence

MIT