Languages
[Edit]
EN

JavaScript / XPath - find any element that contains specific text

7 points
Created by:
Giles-Whittaker
739

In this short article we would like to show how using XPath expression, JavaScript and built-in web browser API, find any element referece that contains specifinc text.

Quicki solution (XPath expression):

Where Text to find here should be replaced with text placed inside element we want to find.

Practical example:

Checkbox input with text node example

Edit

By adding /*[@type='checkbox'] as postfix to previous expression we are able to find all checkbox inputs.

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript / XPath

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join