Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

How can I parse inner HTML by class name where html is assigned to a string variable in Angular 7/Typescript

$
0
0

How can I get the inner text of span by class name ? Here adr_address variable is not a DOM element but a string.

var adr_address = '<span class="street-address">12 Stephenson Rd</span>, <span class="locality">Summertown</span>, <span class="region">TN</span> <span class="postal-code">38483-7005</span>, <span class="country-name">USA</span>';

var street-address = ??;
var locality = ??;
var region = ??;
var postal-code = ??;
var country-name = ??

console.log(street-address);
console.log(locality);
console.log(region);
console.log(postal-code);
console.log(country-name);

The output must be like this :

12 Stephenson Rd

Summertown

TX

38483-7005

USA


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>