extract out text in each line and put it in seperate variables with javascript
- by user357034
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(' ') 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 Smith<br>
555 Anywhere Street<br>
New York, NY 11150<br>
United States<br>
212-555-1212<br>
(Residential Address)
</p>