Alright so here is my code:
<!DOCTYPE html>
<html>
<head>
<!-- head definitions go here -->
</head>
<body>
<textarea id="txtArea"></textarea>
<button id="btn1" onclick="convertHTML()">
Analyse
</button>
<button id="btn2">
Clear
</button>
<div id="output">
</div>
<script>
function clearTxtArea() {
}
function convertHTML() {
var html = document.getElementById('txtArea').value; //Idk of dit werkt lets see
var doc = new DOMParser().parseFromString(html, "text/xml"); //Zet code om van "<div> fzfhez </div>" etc naar echte HTML elementen
console.log(doc)
}
</script>
</body>
</html>
And basically I want to turn the data from the txtArea into html elements (so the input would be like <a>ono<div>test</div></a>
) and I want my code to loop trough all elements etc and give me a json list of how many a elements and how many div's etc there are displayed