extract out text in each line and put it in seperate variables with javascript

Posted by user357034 on Stack Overflow See other posts from Stack Overflow or by user357034
Published on 2011-02-13T20:09:46Z Indexed on 2011/02/13 23:25 UTC
Read the original article Hit count: 188

Filed under:
|

I have the following address which is in a paragraph with no great way to select the individual text areas within. I do not have access to this code. I want to extract out each line and put the text values in a variable for each type. Not sure what would be the best way to do it.

Use .split('<br>') ? then use .split('&nbsp;') to separate the state from the zip same with city and state I am a little lost here.

Here are the variables I would like.

company name, person's name, address1, city, state, country, zip code, phone,

Here is the paragraph that i have. I do not need the '(Residential Address)'

<p>
XYZ Inc<br>
John&nbsp;Smith<br>
555 Anywhere Street<br>
New York, NY&nbsp;11150<br>
United States<br>
212-555-1212<br>

 (Residential Address)


</p>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery