I have a string named stringElement and its value is anchor tag but in string not as node element. How to get the inner text of that tag in pure js?
How it was done using jQuery:
var stringElement = "<a>1</a>";
nodeElement div = document.createElement('div');
$(div).append(stringElement);
var nodeElement2 = $(div).find("a")[0];
var text = $(nodeElement2).text();
text value is 1 <=== This is the target
EDIT: My bad, I found the answer in another question and this should be marked as duplicate.
Here is the questions link: Converting HTML string into DOM elements?
Here is the answer link that worked for me: https://stackoverflow.com/a/3104237/2648837