We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, first of all, thanks for the nice lib.
for example, we have code like this:
<li id="listItem"> This is some text <span id="firstSpan">First span text</span> <span id="secondSpan">Second span text</span> </li>
We need to get This is some text only. the text() method will give us This is some textFirst span textSecond span text
This is some text
text()
This is some textFirst span textSecond span text
There's solution for jQuery: http://stackoverflow.com/questions/3442394/jquery-using-text-to-retrieve-only-text-not-nested-in-child-tags
Is it possible with hQuery? Thanks.
The text was updated successfully, but these errors were encountered:
as workaround I did it that way:
$title = $row->find('#listItem')->text(); foreach ($row->find('#listItem')->children() as $v) $title = str_replace($v->text(), '', $title); $title = trim($title);
But of course, it's not cool :) And could really fail if we have short phrases in children, that are present in our top phrase, i.e.:
children
<li id="listItem"> Unconditional string <span id="firstSpan">condition</span> <span id="secondSpan">ring</span> </li>
Sorry, something went wrong.
Hi @dragonattack Thanks for this hit. I would suggest
$("#foo").contents().not($("#foo").children()).text();
to avoid cloning.
I did not implement .contents yet, but surely it is a necessary method.
.contents
I'm going to implement it whenever I have some free time.
No branches or pull requests
Hi, first of all, thanks for the nice lib.
for example, we have code like this:
We need to get
This is some text
only. thetext()
method will give usThis is some textFirst span textSecond span text
There's solution for jQuery: http://stackoverflow.com/questions/3442394/jquery-using-text-to-retrieve-only-text-not-nested-in-child-tags
Is it possible with hQuery?
Thanks.
The text was updated successfully, but these errors were encountered: