S
S
Sonic_SE2011-12-09 19:53:17
JavaScript
Sonic_SE, 2011-12-09 19:53:17

How to get parts of text separated by
tag?

There is an html like this:

<td><br>
    Name <_br_><br>
    Lastname <_br_><br>
    Address<br>
</td><br>

How can I get 3 variables containing Name, Lastname and Address using jQuery?
I'm trying to parse a page in php and use phpQuery for this, which repeats the functionality of jQuery.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
H
homm, 2011-12-09
@homm

api.jquery.com/contents/
Get the children of each element in the set of matched elements, including text and comment nodes.

E
Eugene, 2011-12-09
@Nc_Soft

Do not force the brain, use explode()

M
Mixailo, 2011-12-09
@Mixailo

Better yet, preg_split("#<br[^>]*>#s",...)

E
Eugene, 2011-12-09
@Nc_Soft

<p><a href="">link</a>text</p>
Who knows how to get text?
Nothing better than this
pq('p')->find(a)->remove();
echo pq('p')->text();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question