/    Sign up×
Community /Pin to ProfileBookmark

How to extract only text content from HTML element ?

I wanted to extract only text content from the below HTML element. For Ex:- I need only “Normal Text” from the below html and if there is no content it should give me empty string (“”)_

<TEXTFORMAT LEADING=”3″><P ALIGN=”LEFT”><FONT FACE =”ARIAL” SIZE=”11″ COLOR=”#333333″ LETTERSPACING=”0″ KERNING=”1″>Normal Text</FONT></P></TEXTFORMAT>

to post a comment
HTMLJavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMar 08.2021 — You can do this by using the property `textContent</C>:<br/>
<C>
let theText = document.querySelector('textformat').textContent;`


Note that your HTML is highly outdated: Attributes align, color, ..., font tag.
Copy linkTweet thisAlerts:
@VITSUSAMar 08.2021 — @vishalvickram1991#1629021 I agree with Sempervivum, your HTML is highly outdated that's why you should update it and as suggested work on it.
×

Success!

Help @vishalvickram1991 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...