Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js get element by innertext

//You could use xpath to accomplish this
var xpath = "//a[text()='SearchingText']";
var matchingElement = document.evaluate(xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;

//You can also search of an element containing some text using this xpath:
var xpath = "//a[contains(text(),'Searching')]";
 
PREVIOUS NEXT
Tagged: #js #element #innertext
ADD COMMENT
Topic
Name
1+9 =