<div>A very lengthy
text that goes on and on</div>
When rendered,
A very lengthy text that goes on and on
will appear as HTML removes the line breaks.
However, locating the div
using the :contains()
CSS selector is challenging due to the line break:
// Returns an empty array
$(':contains("A very lengthy text that goes on and on")');
Is there a method to select the div content while disregarding the line break?
Note: Without adding the line break in the selector, I aim to choose the div
without prior knowledge of the presence of a line break (as it's based on what the user sees, who might not be aware of the line break).